On Tue, Feb 7, 2012 at 8:53 PM, DLo <[email protected]> wrote: > I've noticed this too -- a few GM scripts of mine have broken after > upgrading to FF10/Ubuntu and GreaseMonkey 0.9.15. > > Some preliminary investigation I've done suggests that this may be > related to strict XML parsing inside the cdata. For example, I use > the > var myVar = <str><![CDATA[ > .... > ]]></str>.toString();
The 'problem' is not GM but Firefox itself. It now requires an explicit conversion of the e4x expression into a string. Note that the correct way to do this is by using .toXMLString() and not .toString(). This should fix the problem. It did for me. > I've found that after my FF/GM update, my > scripts fail if my CDATA contain something like: "<input type='radio' > id='blah'>" but works fine if my CDATA contains "<input type='radio' > id='blah'/>" (ie include trailing end-tag slash). That seems to imply > that GM or the e4x engine is being extremely picky about the contents > of the CDATA containing strictly-correct XML. I've always used valid XML in e4x, even with Firefox 3.6 and GM 0.8x. Anything else would throw an error. On a related note I've found that some other things have change in the Javascript interpreter that lead to many script ceasing to work. 1) the above mentioned explicit use of .toXMLString() after an e4x expression 2) implicit .exec does not work any more with regexps: before /foo.*/(string) would do the same as /foo.*/.exec(string). Now only the second one is allowed. The solution is to explicitly use .exec (the short form was anyway non-standard). 3) array-like objects like HTMLCollections or NodeLists (as those returned by getElementsByClassName, or querySelectorAll) are now correctly handled by for each statements. Previously "for each (i in collection)" would return only the elements of the array-like part of the collection. Now it (correctly according to the ECMA specification) returns other properties like 'length' or 'item' causing some script to break. The solution is to re-formulate the whole expression so that no "for...each" or "for each...in" is used, or the 'illegal' elements are properly discarded. This varies from case to case. I'd expect more quirks likes this, most of the related to the Javascript implementation becoming more strict and closer to the specs. -- You received this message because you are subscribed to the Google Groups "greasemonkey-users" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/greasemonkey-users?hl=en.
