- From: Victor Costan <costan@gmail.com>
- Date: Sun, 22 Dec 2013 11:08:40 -0500
- To: whatwg <whatwg@whatwg.org>
I'm trying to re-implement Range.createContextualFragment in Blink following this whatwg spec: http://domparsing.spec.whatwg.org/#extensions-to-the-range-interface There are two issues I'd like to discuss, related to the use of createContextualFragment in SVG contexts. 1) If a Range's context is an <svg> element, I think the XML parsing algorithm should be selected, so the elements in the resulting DocumentFragment would get the SVG namespace. This way, inserting the fragment in an <svg> tree would have the intended effect. Examples: https://bug711821.bugzilla.mozilla.org/attachment.cgi?id=582654 (the red circle should be completely covered by a black circle) https://codereview.chromium.org/115693010/diff/70001/LayoutTests/fast/dom/Range/create-contextual-fragment-from-svg-element-range.html 2) If a Range's context is an SVG document, step 2 in the createContextualFragment algorithm will see a null element, and I think it should create an element in the SVG namespace (not the HTML namespace) with the local name "svg" (not "body"). Again, this is so that inserting the resulting DocumentFragment in the <svg> tree would work as intended. I spent a bit of time thinking of how one would get a Range pointing to an SVG document, to see if this issue even applies to HTML5. I eventually found that using <svg> inside <embed> creates an SVG document inside the HTML5 document, so I can use createRange on the HTML5 document, and then pass the SVG document to Range.setStart. I can post code if it helps make this clearer. I look forward to your thoughts and comments. Victor
Received on Sunday, 22 December 2013 16:09:30 UTC