Bug 100831 - [Shadow] Element should have getter and setter of attribute 'pseudo'
Summary: [Shadow] Element should have getter and setter of attribute 'pseudo'
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: DOM (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Shinya Kawanaka
URL:
Keywords:
Depends on:
Blocks: 100812
  Show dependency treegraph
 
Reported: 2012-10-31 02:10 PDT by Shinya Kawanaka
Modified: 2012-11-19 15:23 PST (History)
9 users (show)

See Also:


Attachments
WIP (4.75 KB, patch)
2012-10-31 04:21 PDT, Shinya Kawanaka
no flags Details | Formatted Diff | Diff
Patch (5.65 KB, patch)
2012-10-31 21:51 PDT, Shinya Kawanaka
no flags Details | Formatted Diff | Diff
Patch (5.69 KB, patch)
2012-11-01 18:29 PDT, Shinya Kawanaka
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Shinya Kawanaka 2012-10-31 02:10:45 PDT
According to Shadow DOM spec
https://dvcs.w3.org/hg/webcomponents/raw-file/tip/spec/shadow/index.html#extensions-to-element
Element should have getter/setter of attribute 'pseudo'.
Comment 1 Shinya Kawanaka 2012-10-31 04:21:00 PDT
Created attachment 171616 [details]
WIP
Comment 2 Shinya Kawanaka 2012-10-31 04:22:01 PDT
+haraken

I would like to return 'null' when pseudo attribute is not set.
How do I write idl?

This WIP patch returns empty string instead of null.
Comment 3 Kentaro Hara 2012-10-31 05:23:35 PDT
(In reply to comment #2)
> +haraken
> 
> I would like to return 'null' when pseudo attribute is not set.
> How do I write idl?
> 
> This WIP patch returns empty string instead of null.

[TreatReturnedNullStringAs=Null] would be helpful:
https://trac.webkit.org/wiki/WebKitIDL#TreatReturnedNullStringAs
Comment 4 Shinya Kawanaka 2012-10-31 21:51:59 PDT
Created attachment 171767 [details]
Patch
Comment 5 Shinya Kawanaka 2012-10-31 21:52:46 PDT
This patch just exposes 'pseudo' attribute.
I would like to merge 'pseudo' attribute and pseudoShadowId in Bug 100451.
Comment 6 Shinya Kawanaka 2012-10-31 21:53:22 PDT
Oops, not Bug 100451 but Bug 100812
Comment 7 Hajime Morrita 2012-11-01 03:10:41 PDT
Comment on attachment 171767 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=171767&action=review

This might be a question  to the spec rather than to the implementation, but shouldn't we aware of the validity of the value?
Don't we need to reject invalid pseudo values?

> Source/WebCore/dom/Element.idl:122
> +    [TreatReturnedNullStringAs=Null] attribute DOMString pseudo;

Please guard this using [V8EnabledAtRuntime] annotation. Also, I guess you can use [Reflect].
Comment 8 Dimitri Glazkov (Google) 2012-11-01 09:43:40 PDT
(In reply to comment #7)
> (From update of attachment 171767 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=171767&action=review
> 
> This might be a question  to the spec rather than to the implementation, but shouldn't we aware of the validity of the value?
> Don't we need to reject invalid pseudo values?

That's already in the spec. We don't reject invalid values, we just ignore them when matching.

> 
> > Source/WebCore/dom/Element.idl:122
> > +    [TreatReturnedNullStringAs=Null] attribute DOMString pseudo;
> 
> Please guard this using [V8EnabledAtRuntime] annotation. Also, I guess you can use [Reflect].
Comment 9 Dimitri Glazkov (Google) 2012-11-01 09:45:00 PDT
Comment on attachment 171767 [details]
Patch

Consider morrita's comments.
Comment 10 Shinya Kawanaka 2012-11-01 18:08:12 PDT
(In reply to comment #7)
> (From update of attachment 171767 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=171767&action=review
> 
> This might be a question  to the spec rather than to the implementation, but shouldn't we aware of the validity of the value?
> Don't we need to reject invalid pseudo values?
> 
> > Source/WebCore/dom/Element.idl:122
> > +    [TreatReturnedNullStringAs=Null] attribute DOMString pseudo;
> 
> Please guard this using [V8EnabledAtRuntime] annotation. Also, I guess you can use [Reflect].

When I used [Reflect], 'pseudo' returned empty string instead of null...
Comment 11 Shinya Kawanaka 2012-11-01 18:29:32 PDT
Created attachment 171965 [details]
Patch
Comment 12 Shinya Kawanaka 2012-11-01 18:30:39 PDT
Added V8EnabledAtRuntime guard.
I didn't use Reflect because pseudo returns empty string instead of null.
Comment 13 Hajime Morrita 2012-11-01 19:01:27 PDT
(In reply to comment #12)
> Added V8EnabledAtRuntime guard.
> I didn't use Reflect because pseudo returns empty string instead of null.

This smells like the spec is inconsistent with other part of HTML. We might want to reconsider the behavior.
Comment 14 Hajime Morrita 2012-11-01 19:02:05 PDT
Comment on attachment 171965 [details]
Patch

But let's land this for now.
Comment 15 Shinya Kawanaka 2012-11-01 19:04:29 PDT
(In reply to comment #13)
> (In reply to comment #12)
> > Added V8EnabledAtRuntime guard.
> > I didn't use Reflect because pseudo returns empty string instead of null.
> 
> This smells like the spec is inconsistent with other part of HTML. We might want to reconsider the behavior.

I think so, too. I didn't re-read the HTML spec yet though.
Comment 16 Shinya Kawanaka 2012-11-01 19:21:29 PDT
For example, title attribute returns empty string when it's not specified.

http://jsfiddle.net/B3SZT/
Comment 17 Shinya Kawanaka 2012-11-01 19:26:03 PDT
According to this, non-readonly attribute uses DOMString instead of DOMString?.
http://dev.w3.org/html5/spec/elements.html#htmlelement
Comment 18 Shinya Kawanaka 2012-11-01 19:30:25 PDT
Filed https://www.w3.org/Bugs/Public/show_bug.cgi?id=19825 in ShadowDOM spec.
Comment 19 WebKit Review Bot 2012-11-01 23:35:49 PDT
Comment on attachment 171965 [details]
Patch

Clearing flags on attachment: 171965

Committed r133268: <http://trac.webkit.org/changeset/133268>
Comment 20 WebKit Review Bot 2012-11-01 23:35:54 PDT
All reviewed patches have been landed.  Closing bug.
Comment 21 Elliott Sprehn 2012-11-19 00:08:31 PST
Note that all other attribute getters return empty string (id, className, title, etc.) so we definitely need to fix the spec and our behavior before shipping Shadow DOM publicly.
Comment 22 Dimitri Glazkov (Google) 2012-11-19 09:26:44 PST
(In reply to comment #21)
> Note that all other attribute getters return empty string (id, className, title, etc.) so we definitely need to fix the spec and our behavior before shipping Shadow DOM publicly.

Okay: https://www.w3.org/Bugs/Public/show_bug.cgi?id=19825
Comment 23 Dimitri Glazkov (Google) 2012-11-19 15:23:06 PST
(In reply to comment #22)
> (In reply to comment #21)
> > Note that all other attribute getters return empty string (id, className, title, etc.) so we definitely need to fix the spec and our behavior before shipping Shadow DOM publicly.
> 
> Okay: https://www.w3.org/Bugs/Public/show_bug.cgi?id=19825

http://dvcs.w3.org/hg/webcomponents/rev/229cda7a6d0c