[Webkit-unassigned] [Bug 247771] New: CSSOM serializes most shorthands without checking !important flag

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Thu Nov 10 16:25:38 PST 2022


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

            Bug ID: 247771
           Summary: CSSOM serializes most shorthands without checking
                    !important flag
           Product: WebKit
           Version: WebKit Nightly Build
          Hardware: Unspecified
                OS: Unspecified
            Status: NEW
          Severity: Normal
          Priority: P2
         Component: CSS
          Assignee: webkit-unassigned at lists.webkit.org
          Reporter: obrufau at igalia.com

>From https://drafts.csswg.org/cssom/#dom-cssstyledeclaration-getpropertyvalue

3. If important flags of all declarations in list are same, then return the serialization of list.
4. Return the empty string. 

Run this code:

var allCSSProps = new Set();
for (let obj = document.createElement("div").style; obj; obj = Reflect.getPrototypeOf(obj)) {
  for (let name of Object.getOwnPropertyNames(obj)) {
    let prop = name.replace(/[A-Z]/g, c => "-" + c.toLowerCase());
    if (CSS.supports(prop, "initial")) {
      allCSSProps.add(prop);
    }
  }
}
var style = document.createElement("div").style;
var bad = [];
var good = [];
for (let prop of allCSSProps) {
  style.cssText = "";
  style.setProperty(prop, "initial");
  if (style.length > 1) {
    style.setProperty(style[0], "initial", "important");
    if (style.getPropertyValue(prop) !== "") {
      bad.push(prop);
    } else good.push(prop);
  }
}
bad;

Expected: empty array

Actual: [
  "-epub-text-emphasis",
  "-webkit-animation",
  "-webkit-border-after",
  "-webkit-border-before",
  "-webkit-border-end",
  "-webkit-border-start",
  "-webkit-column-rule",
  "-webkit-columns",
  "-webkit-flex",
  "-webkit-flex-flow",
  "-webkit-mask",
  "-webkit-mask-position",
  "-webkit-perspective-origin",
  "-webkit-text-decoration",
  "-webkit-text-emphasis",
  "-webkit-text-stroke",
  "-webkit-transform-origin",
  "-webkit-transition",
  "animation",
  "background",
  "background-position",
  "border-block-end",
  "border-block-start",
  "border-bottom",
  "border-inline-end",
  "border-inline-start",
  "border-left",
  "border-right",
  "border-spacing",
  "border-top",
  "column-rule",
  "columns",
  "container",
  "flex",
  "flex-flow",
  "font",
  "font-synthesis",
  "font-variant",
  "grid-area",
  "grid-column",
  "grid-row",
  "grid-template",
  "list-style",
  "marker",
  "mask",
  "mask-position",
  "outline",
  "perspective-origin",
  "place-content",
  "place-items",
  "place-self",
  "text-emphasis",
  "transform-origin",
  "transition"
]

-- 
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/20221111/e6683623/attachment.htm>


More information about the webkit-unassigned mailing list