Diff for "JavaScript"

Not logged in - Log In / Register

Differences between revisions 6 and 7
Revision 6 as of 2009-03-04 19:30:10
Size: 338
Editor: mars
Comment:
Revision 7 as of 2009-03-05 17:01:30
Size: 1307
Editor: mars
Comment:
Deletions are marked like this. Additions are marked like this.
Line 15: Line 15:
== Zope JavaScript Gotchas ==

Zope's TAL engine is clever, and helpfully breaks any <script> nodes in your template. Here's how to make the TAL interpreter do the right thing:

{{{
<js tal:replace="structure <script>...</script>" />
}}}

----

Zope3 forms have field names with dots in them, like this: {{{<input id="field.action.visibility" name="field.action.visibility" type="hidden"/>}}}. This is ''probably'' invalid by the W3C identites specification, and makes it impossible to select nodes with CSS3 selectors, and YUI3's `Y.get()` call.

This will return `null`:

{{{
  Y.get('#field.action.visibility');
}}}

To work around this, you can take advantage of `Y.get()`'s node-wrapping abilities.

These all work correctly, returning a `Node` instance:

{{{
  Y.get(Y.DOM.byId('field.action.visibility'));
  Y.get(document.getElementById('field.action.visibility'));
  Y.get("#someform input[name='field.action.visibility']");
}}}

JavaScript in Launchpad

This page covers everything to do with JavaScript development in Launchpad.

Some useful links:

Zope JavaScript Gotchas

Zope's TAL engine is clever, and helpfully breaks any <script> nodes in your template. Here's how to make the TAL interpreter do the right thing:

<js tal:replace="structure <script>...</script>" />


Zope3 forms have field names with dots in them, like this: <input id="field.action.visibility" name="field.action.visibility" type="hidden"/>. This is probably invalid by the W3C identites specification, and makes it impossible to select nodes with CSS3 selectors, and YUI3's Y.get() call.

This will return null:

  Y.get('#field.action.visibility');

To work around this, you can take advantage of Y.get()'s node-wrapping abilities.

These all work correctly, returning a Node instance:

  Y.get(Y.DOM.byId('field.action.visibility'));
  Y.get(document.getElementById('field.action.visibility'));
  Y.get("#someform input[name='field.action.visibility']");


CategoryCategory

JavaScript (last edited 2011-10-28 19:33:58 by flacoste)