[whatwg] Range.createContextualFragment in SVG contexts

Cameron McCormack cam at mcc.id.au
Sat Dec 28 02:29:49 PST 2013


Hi Victor,

Victor Costan wrote:
> 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

I think it would be unexpected that XML parsing is used here, when HTML 
parsing was used to get the SVG fragment in the document in the first 
place.  Maybe the HTML fragment parsing algorithm should be changed to 
push the <svg> element on to the stack of open elements so that the 
parser will interpret the "<circle .../>" as foreign content?



More information about the whatwg mailing list