Intent to Deprecate and Remove: Element.prefix setter

63 views
Skip to first unread message

Philip Jägenstedt

unread,
May 27, 2014, 5:25:14 PM5/27/14
to blink-dev

Primary eng (and PM) emails

phi...@opera.com


Summary

In Element.idl, make attribute DOMString prefix readonly.


Motivation

The attribute is readonly in the spec: 

http://dom.spec.whatwg.org/#element 


Ad-hoc testing shows that none of Firefox, IE or Presto support the setter: 

http://software.hixie.ch/utilities/js/live-dom-viewer/?saved=3042


Compatibility Risk

Setting a readonly attribute is silently ignored, no exceptions will be thrown. Given the lack of support in non-WebKit/Blink browsers, the risk seems low.


Alternative implementation suggestion for web developers

Don't set the attribute, it won't do anything useful.


Usage information from UseCounter

http://www.chromestatus.com/metrics/feature/timeline/popularity/224


The peak value to date is 0.0008%.


Entry on chromestatus.com and/or MDN

None.


Requesting approval to remove too?

Yes, usage is so low that a deprecation period does not seem useful.

Eric Seidel

unread,
May 27, 2014, 6:24:27 PM5/27/14
to Philip Jägenstedt, blink-dev
Hopefully the lack of support in IE would suggest this has a lowered
risk of breaking enterprise.

Sounds like we're the odd man out.

LGTM.

Dimitri Glazkov

unread,
May 27, 2014, 6:25:26 PM5/27/14
to Eric Seidel, Philip Jägenstedt, blink-dev
LGTM.

TAMURA, Kent

unread,
May 27, 2014, 7:20:46 PM5/27/14
to Philip Jägenstedt, blink-dev

DOM Level 2 Core says Node::prefix is mutable.


> Ad-hoc testing shows that none of Firefox, IE or Presto support the setter: 

http://software.hixie.ch/utilities/js/live-dom-viewer/?saved=3042


The test looks incorrect.  We should try to set a prefix associated to a namespace.

--
TAMURA Kent
Software Engineer, Google


Boris Zbarsky

unread,
May 27, 2014, 9:18:07 PM5/27/14
to blink-dev
On 5/27/14, 7:20 PM, TAMURA, Kent wrote:
> DOM Level 2 Core says Node::prefix is mutable.

For what it's worth, Gecko changed it to be immutable in Firefox 5 (so
about 3 years ago). We have had no reports of resulting issues.

-Boris

Philip Jägenstedt

unread,
May 28, 2014, 7:59:32 AM5/28/14
to TAMURA, Kent, blink-dev
On Wed, May 28, 2014 at 1:20 AM, TAMURA, Kent <tk...@chromium.org> wrote:
> DOM Level 2 Core says Node::prefix is mutable.
>
>
>> Ad-hoc testing shows that none of Firefox, IE or Presto support the
>> setter:
>
>> http://software.hixie.ch/utilities/js/live-dom-viewer/?saved=3042
>
>
> The test looks incorrect. We should try to set a prefix associated to a
> namespace.

Thanks for paying attention. The old spec for this is
http://www.w3.org/TR/DOM-Level-2-Core/core.html#ID-NodeNSPrefix

It doesn't say that the prefix needs to be known, but I tried changing
the test to use an element that has a prefix to begin with:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:a="http://example.com/a">
<head><title></title></head>
<body>
<a:element/>
<script>
var elm = document.querySelector("element");
elm.prefix = "b";
alert('prefix: ' + elm.prefix + ', nodeName: ' + elm.nodeName);
</script>
</body>
</html>

With this test, Gecko and Presto alert "prefix: a, nodeName:
a:element" while IE11 alerts "prefix: b, nodeName: b:element".

In other words, the setter does do something in IE11, but not when
prefix is initially null it seems. I haven't reverse engineered
further, but it doesn't exactly match what Blink/WebKit has
implemented.

I checked the history of Presto and it looks like it never supported
the setter, unlike Gecko which apparently once did.

In other words, risk is higher than I suggested, but still seems
pretty reasonable to me.

(I'm going to ignore the 2 LGTMs from Eric and Dimitri and await new feedback.)

Philip

Eric Seidel

unread,
May 28, 2014, 9:44:31 AM5/28/14
to Philip Jägenstedt, TAMURA, Kent, blink-dev
I suspect this just gets lumped into the "stuff we'd like to remove if
we can ever remove support for displayed XML content" bucket. :)

How much does it help us to remove this setting code? Sufficient to
justify the risks to XHTML sites from the IE6 era which depend on this
feature? (or xhr.responseXML content which re-writes prefixes...)

Philip Jägenstedt

unread,
May 28, 2014, 10:37:46 AM5/28/14
to Eric Seidel, TAMURA, Kent, blink-dev
It's a pretty small amount of code to remove:
https://codereview.chromium.org/298063010

What I'm looking for is the path of least resistance towards having
the spec and all implementations actually agree. Every little
discrepancy is an opportunity for Web authors to write
non-interoperable code, after all. Asking the spec and Gecko to change
would be the alternative path.

I can understand the caution given the failed Attr-related removals.
Since this is an old and once-standard API, maybe a long-ish
deprecation period is in order, despite the low usage?

Philip

Ojan Vafai

unread,
May 28, 2014, 1:08:29 PM5/28/14
to Philip Jägenstedt, Eric Seidel, TAMURA, Kent, blink-dev
I don't think this is in the same category as the Attr or XML related things. Those were long-standing APIs that had broad cross-browser interoperability.

This is an API that has almost no interoperability between any browsers.

LGTM to deprecate and then remove after a release or two.

Philip Jägenstedt

unread,
May 28, 2014, 2:00:10 PM5/28/14
to Ojan Vafai, blink-dev, TAMURA, Kent, Eric Seidel

Thanks Ojan. If there are no objections in a couple of days I'll go with deprecation and revisit when that's been in stable for a few months.

Philip

TAMURA, Kent

unread,
May 28, 2014, 6:47:32 PM5/28/14
to Philip Jägenstedt, Ojan Vafai, blink-dev, Eric Seidel
ok, lgtm

Reply all
Reply to author
Forward
0 new messages