RESOLVED FIXED 6520
Add support for insertAdjacentElement
https://bugs.webkit.org/show_bug.cgi?id=6520
Summary Add support for insertAdjacentElement
Attachments
Darin's rough cut patch (2.19 KB, patch)
2006-01-12 20:40 PST, Geoffrey Garen
no flags
simple testcase (770 bytes, text/html)
2006-03-09 11:23 PST, Alexander Kellett
no flags
patch taking into account move to Element, and implementing bindings, no exceptions thrown yet (3.70 KB, patch)
2006-03-09 11:37 PST, Alexander Kellett
darin: review-
latest testcase (1.59 KB, text/html)
2006-03-19 09:57 PST, Alexander Kellett
no flags
latest testcase (1.87 KB, text/html)
2006-03-19 10:51 PST, Alexander Kellett
no flags
testcases (2.66 KB, patch)
2006-03-26 21:06 PST, Alexander Kellett
darin: review+
patch taking into account move to Element, and implementing bindings, no exceptions thrown yet (4.13 KB, patch)
2006-03-26 21:06 PST, Alexander Kellett
darin: review+
Geoffrey Garen
Comment 1 2006-01-12 20:40:26 PST
Created attachment 5638 [details] Darin's rough cut patch "A rough first cut of the method only, not the JavaScript binding."
Anders Carlsson
Comment 2 2006-01-13 08:32:57 PST
I did some investigation on how insertAdjacentElement works in WinIE: * This function only exists on elements, so it should be moved to ElementImpl * Passing a non-element object as newChild throws an E_INVALIDARG COM exception * If the element has no parent and where is "beforeBegin" or "afterEnd", a document fragment is created and the elements appended in the correct order. This document fragment isn't returned anywhere * Passing a bogus string as where also throws an E_INVALIDARG exception.
Alexander Kellett
Comment 3 2006-03-08 14:08:35 PST
does this need to be bound to HTMLElement or DOMElement?
Alexander Kellett
Comment 4 2006-03-09 11:23:01 PST
Created attachment 6960 [details] simple testcase
Alexander Kellett
Comment 5 2006-03-09 11:37:06 PST
Created attachment 6961 [details] patch taking into account move to Element, and implementing bindings, no exceptions thrown yet
Alexander Kellett
Comment 6 2006-03-11 13:41:57 PST
andersca, not sure i understand your 3rd point? there is a side effect? does dom tree walking after insertion result in the added element having been inserted into the fragment? what would be the equiv of a "E_INVALIDARG COM exception" for webkit? can't really go any further at this point as i don't have ie. going to mark for review and hope for some feedback.
Darin Adler
Comment 7 2006-03-11 22:10:10 PST
Comment on attachment 6961 [details] patch taking into account move to Element, and implementing bindings, no exceptions thrown yet This should be done with an new style IDL-file-based binding, not an old style hand-written binding, because it has no special requirements. So it should be added to Element.idl and kjs_dom.cpp and kjs_dom.h should be left untouched.
Alexander Kellett
Comment 8 2006-03-12 02:21:58 PST
andersca had already said not to do so.. tho i forget the reasoning.
Darin Adler
Comment 9 2006-03-13 20:49:28 PST
(In reply to comment #8) > andersca had already said not to do so.. tho i forget the reasoning. Anders, why?
Alexander Kellett
Comment 10 2006-03-13 21:50:24 PST
spoke to anders since my last comment and realized that his comment was in response to something else :P this works just fine - + // IE only extension + Node insertAdjacentElement(in DOMString position, + in Node newAttr) + raises(DOMException); + do i need to fill out the exception throwing before committing (after another review) or is this enough for the moment?
Darin Adler
Comment 11 2006-03-14 10:56:02 PST
I'd like to see the test cases and exceptions in before we land this. Shouldn't be too difficult to research how it works and make a nice thorough case. I don't want to have to revisit this later.
Alexander Kellett
Comment 12 2006-03-14 12:20:46 PST
still not sure what andersca's reference to "E_INVALIDARG" implies, is this just a case of adding that to the DOMException class?
Anders Carlsson
Comment 13 2006-03-14 12:55:32 PST
Since the JS wrappers in WinIE wrap COM objects, there are some native COM exceptions that are being used in WinIE, for example the E_INVALIDARG exception.
Alexander Kellett
Comment 14 2006-03-19 09:57:40 PST
Created attachment 7175 [details] latest testcase
Alexander Kellett
Comment 15 2006-03-19 10:51:11 PST
Created attachment 7176 [details] latest testcase
Alexander Kellett
Comment 16 2006-03-26 21:06:18 PST
Created attachment 7320 [details] testcases
Alexander Kellett
Comment 17 2006-03-26 21:06:54 PST
Created attachment 7321 [details] patch taking into account move to Element, and implementing bindings, no exceptions thrown yet
Darin Adler
Comment 18 2006-03-26 22:46:45 PST
Comment on attachment 7321 [details] patch taking into account move to Element, and implementing bindings, no exceptions thrown yet Looks fine. r=me
Eric Seidel (no email)
Comment 19 2006-03-27 17:07:02 PST
Lypie commited this.
Note You need to log in before you can comment on or make changes to this bug.