Bug 79075 - <style scoped>: Add @global rules
Summary: <style scoped>: Add @global rules
Status: RESOLVED WONTFIX
Alias: None
Product: WebKit
Classification: Unclassified
Component: CSS (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Roland Steiner
URL:
Keywords:
Depends on:
Blocks: 49142
  Show dependency treegraph
 
Reported: 2012-02-20 21:30 PST by Roland Steiner
Modified: 2016-08-11 12:32 PDT (History)
18 users (show)

See Also:


Attachments
work-in-progress (42.76 KB, patch)
2012-03-07 05:31 PST, Roland Steiner
no flags Details | Formatted Diff | Diff
Patch (100.71 KB, patch)
2012-03-09 01:13 PST, Roland Steiner
koivisto: review-
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Roland Steiner 2012-02-20 21:30:14 PST
Add @global rules to allow scoped style rules to "react" to the surrounding context (see HTML5 spec)
Comment 1 Roland Steiner 2012-03-07 05:31:35 PST
Created attachment 130606 [details]
work-in-progress

work-in-progress patch. compiles, but no tests yet. checking EWS, mostly (but any comments welcome!)
Comment 2 WebKit Review Bot 2012-03-07 06:09:37 PST
Comment on attachment 130606 [details]
work-in-progress

Attachment 130606 [details] did not pass chromium-ews (chromium-xvfb):
Output: http://queues.webkit.org/results/11851043
Comment 3 Early Warning System Bot 2012-03-07 06:54:50 PST
Comment on attachment 130606 [details]
work-in-progress

Attachment 130606 [details] did not pass qt-ews (qt):
Output: http://queues.webkit.org/results/11850084
Comment 4 Roland Steiner 2012-03-09 01:13:44 PST
Created attachment 131005 [details]
Patch

Patch - it's big, but the largest part is straightforward plumbing.
Comment 5 Antti Koivisto 2012-03-12 04:10:59 PDT
Comment on attachment 131005 [details]
Patch

I feel the scoped stylesheet feature is getting too complex and bloaty for anyone to use effectively. If I understand correctly @global wouldn't be needed in the first place if the spec wasn't limiting the selector matching to the scope by default. It seems to me that just using explicit :scope ancestor for scoped rules would achieve the same result with much less spec and implementation bloat.

Since the required code changes are invasive, I don't think we should implement any more of this feature until it is cleaned up.
Comment 6 Tab Atkins 2012-03-13 08:59:04 PDT
(In reply to comment #5)
> (From update of attachment 131005 [details])
> I feel the scoped stylesheet feature is getting too complex and bloaty for anyone to use effectively. If I understand correctly @global wouldn't be needed in the first place if the spec wasn't limiting the selector matching to the scope by default. It seems to me that just using explicit :scope ancestor for scoped rules would achieve the same result with much less spec and implementation bloat.

This was discussed on mailing lists.  The general feeling is that the behavior you seem to prefer (matching the behavior of querySelector) is basically broken; it is very rarely what authors actually want to happen, and it causes a lot of confusion and annoyance when authors run into it (with elements being matched that they didn't expect).  The current behavior appears to be *nearly always* what authors expect and want, but there are still occasional instances where you really do want to match outside of the scoped subtree.

This is why the new find() and findAll() methods are instead defaulting to the current <style scoped> behavior, where the entire selector must match within the scope.  There's no equivalent @global construct for find/All(), but that's because JS can hack around this issue when necessary.
Comment 7 Konstantin Tokarev 2016-08-11 12:32:00 PDT
<style scoped> was removed from tree in r156683, as well as from spec.