[Webkit-unassigned] [Bug 271665] New: CSSOM serialization for nested a rule gets '&' added to selector text when it shouldn't

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Mon Mar 25 11:33:24 PDT 2024


https://bugs.webkit.org/show_bug.cgi?id=271665

            Bug ID: 271665
           Summary: CSSOM serialization for nested a rule gets '&' added
                    to selector text when it shouldn't
           Product: WebKit
           Version: Safari Technology Preview
          Hardware: Unspecified
                OS: Unspecified
            Status: NEW
          Severity: Normal
          Priority: P2
         Component: CSS
          Assignee: webkit-unassigned at lists.webkit.org
          Reporter: qianlangchen at apple.com

Created attachment 470593

  --> https://bugs.webkit.org/attachment.cgi?id=470593&action=review

Screenshot demo: Nested rule's cssText unexpectedly begins with `&` in Safari but not in Chrome

The return value of the `CSSRule.cssText` getter always starts with an `&` if the rule is nested, even when the source didn't include an `&`.

To quickly reproduce, run the following code in the inspector's console:
    s = new CSSStyleSheet();
    s.insertRule('body { div { opacity: 0.5; } }', 0);
    s.cssRules[0].cssRules[0].cssText

Observe that the output by Safari is:
    "& div { opacity: 0.5; }"

The expected output should be the following, which Chrome and Firefox also present:
    "div { opacity: 0.5; }"

The specs (https://drafts.csswg.org/cssom-1/#serializing-selectors) did not suggest that an implied `&` be prepended to the selector text.

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-unassigned/attachments/20240325/f23fea10/attachment-0001.htm>


More information about the webkit-unassigned mailing list