Adds cloneNode code to DOMita that copies over custom properties, and
information necessary to remove listeners, and implements a cloneNode
operation in bridal to work around problems in IE.
Thanks, Mike! This looks great, and will help a lot. The only really substantive comment ...
17 years, 11 months ago
(2008-12-12 18:51:28 UTC)
#4
Thanks, Mike! This looks great, and will help a lot.
The only really substantive comment I have is on copying the properties___ map.
I went back and looked at the spec; it doesn't mention properties at all, only
attributes. I tested cloning on FF3 and properties *don't* get copied
there--not even when they're simple strings. The only properties that exist on
the clone are those backed by attributes. So we may want to ignore the
properties___ map entirely.
http://codereview.appspot.com/10266/diff/402/17
File src/com/google/caja/plugin/bridal.js (right):
http://codereview.appspot.com/10266/diff/402/17#newcode210
Line 210: // children if deep are copied.
children if the deep flag is set, are copied
http://codereview.appspot.com/10266/diff/402/17#newcode229
Line 229: case 'string': case 'number': case 'boolean':
Looks like the DOM level 2 spec is silent on coping properties. FF3 doesn't
copy properties at all, no matter what their type. Is it important *not* to
copy properties to the clone in order to prevent leaking information?
http://codereview.appspot.com/10266/diff/402/16
File src/com/google/caja/plugin/domita.js (right):
http://codereview.appspot.com/10266/diff/402/16#newcode1286
Line 1286: return this.getOwnerDocument().getElementsByTagName(tagName);
Good catch!
http://codereview.appspot.com/10266/diff/402/12
File tests/com/google/caja/plugin/domita_test_untrusted.html (right):
http://codereview.appspot.com/10266/diff/402/12#newcode1216
Line 1216: for (var i = 0, opt; (opt = el.options[i]); ++i) {
Did you mean to initialize opt?
http://codereview.appspot.com/10266/diff/402/17 File src/com/google/caja/plugin/bridal.js (right): http://codereview.appspot.com/10266/diff/402/17#newcode229 Line 229: case 'string': case 'number': case 'boolean': Removed code ...
17 years, 11 months ago
(2008-12-12 21:57:29 UTC)
#5
I synced and picked up some changes to getAttribute/hasAttribute that broke tests on IE. I ...
17 years, 11 months ago
(2008-12-12 23:18:38 UTC)
#6
I synced and picked up some changes to getAttribute/hasAttribute that broke
tests on IE. I reimplement hasAttribute to work on IE, and reworked
getAttribute to return '' instead of null as specified in DOM2 Core.
Changed to return null consistently for getAttribute on an unspecified&undefaulted or non-existent attribute on IE. ...
17 years, 11 months ago
(2008-12-13 00:12:09 UTC)
#8
Changed to return null consistently for getAttribute on an
unspecified&undefaulted or non-existent attribute on IE.
http://codereview.appspot.com/10266/diff/605/1016
File src/com/google/caja/plugin/domita.js (right):
http://codereview.appspot.com/10266/diff/605/1016#newcode207
Line 207: } else if (typeof opt_data == 'string') {
On 2008/12/12 23:46:22, metaweta wrote:
> ===
Done.
http://codereview.appspot.com/10266/diff/605/1016#newcode1406
Line 1406: if ((attribKey = tagName + ':' + attribName,
On 2008/12/12 23:46:22, metaweta wrote:
> Is this style for performance? If not, I'd prefer
>
> attribKey = tagName + ':' + attribName;
> if (html4.ATTRIBS.hasOwnProperty(attribKey)) {
> ...
> }
>
> since, despite all training, I still read = as === in
> if (x = y) { ... }
>
I don't know. You'd have to ask Ihab.
Issue 10266: Implement cloneNode for DOMita.
(Closed)
Created 17 years, 12 months ago by MikeSamuel
Modified 17 years, 4 months ago
Reviewers: MikeSamuel, metaweta
Base URL: http://google-caja.googlecode.com/svn/trunk/
Comments: 17