W3C home > Mailing lists > Public > whatwg@whatwg.org > October 2014

[whatwg] Fwd: Range.createContextualFragment in SVG contexts

From: Daniel Trebbien <dtrebbien@gmail.com>
Date: Tue, 28 Oct 2014 08:35:11 -0400
Message-ID: <CABrgu5QmwiAqio-G+dnR8ZAPgGpyjU3johomqVrRYrJuj+bp2g@mail.gmail.com>
To: WHATWG <whatwg@whatwg.org>
(My apologies if you get this twice.  I haven't seen my message on the public
archives <http://lists.w3.org/Archives/Public/public-whatwg-archive/>, so I
suspect that it was dropped.)

On Sat, Dec 28, 2013 at 5:29 AM, Cameron McCormack <cam@mcc.id.au> wrote:

> 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?
>


Issues related to Range.createContextualFragment() in SVG contexts are
starting to come up in bug reports:
- https://bugzilla.mozilla.org/show_bug.cgi?id=1087715
- https://code.google.com/p/chromium/issues/detail?id=426400

Should Cameron's idea for changing the HTML fragment parsing algorithm be
implemented?

One other idea is to change the "in body" insertion mode spec so that there
are 'A start tag whose tag name is one of: "defs", "g", "svg"' steps, but I
personally think that Cameron's idea is much better.

Daniel
Received on Tuesday, 28 October 2014 12:35:37 UTC

This archive was generated by hypermail 2.4.0 : Wednesday, 22 January 2020 17:00:24 UTC