<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugs.webkit.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4.1"
          urlbase="https://bugs.webkit.org/"
          
          maintainer="admin@webkit.org"
>

    <bug>
          <bug_id>185953</bug_id>
          
          <creation_ts>2018-05-24 11:56:09 -0700</creation_ts>
          <short_desc>cssText serialization doesn&apos;t contain properties with &quot;initial&quot; values</short_desc>
          <delta_ts>2023-02-09 12:42:22 -0800</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebKit</product>
          <component>CSS</component>
          <version>Safari 11</version>
          <rep_platform>Mac</rep_platform>
          <op_sys>macOS 10.13</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          <see_also>https://bugs.webkit.org/show_bug.cgi?id=69083</see_also>
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords>BrowserCompat, InRadar, Regression</keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          <dependson>242775</dependson>
    
    <dependson>248913</dependson>
          <blocked>81737</blocked>
    
    <blocked>190496</blocked>
          <everconfirmed>1</everconfirmed>
          <reporter name="Ben Dean">bendean837</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          <cc>ahmad.saleem792</cc>
    
    <cc>bfulgham</cc>
    
    <cc>karlcow</cc>
    
    <cc>koivisto</cc>
    
    <cc>obrufau</cc>
    
    <cc>simon.fraser</cc>
    
    <cc>webkit-bug-importer</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>1427007</commentid>
    <comment_count>0</comment_count>
    <who name="Ben Dean">bendean837</who>
    <bug_when>2018-05-24 11:56:09 -0700</bug_when>
    <thetext>This happens for both CSSStyleDeclaration.cssText and CSSRule.cssText.

```
var styleEl = document.createElement(&apos;style&apos;);
styleEl.textContent = &apos;body { width: initial; }&apos;
document.head.appendChild(styleEl);

console.log(styleEl.sheet.cssRules[0].cssText);
```

Expected:
&gt; &quot;body { width: initial; }&quot;

Got:
&gt; &quot;body { }&quot;

You can try it here at https://jsfiddle.net/vu434w60/

Thanks!</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1459402</commentid>
    <comment_count>1</comment_count>
    <who name="Oriol Brufau">obrufau</who>
    <bug_when>2018-09-13 10:13:19 -0700</bug_when>
    <thetext>The cause seems that StyleProperties::asText() in Source/WebCore/css/StyleProperties.cpp has this code:

        if (propertyID != CSSPropertyCustom &amp;&amp; value == &quot;initial&quot; &amp;&amp; !CSSProperty::isInheritedProperty(propertyID))
            continue;

This was added in https://bugs.webkit.org/show_bug.cgi?id=81737

But it can&apos;t simply be removed, the logic to handle serialization of shorthands and longhands needs to be refactored.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1884178</commentid>
    <comment_count>2</comment_count>
    <who name="Radar WebKit Bug Importer">webkit-bug-importer</who>
    <bug_when>2022-07-15 13:43:11 -0700</bug_when>
    <thetext>&lt;rdar://problem/97091857&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1900628</commentid>
    <comment_count>3</comment_count>
    <who name="Oriol Brufau">obrufau</who>
    <bug_when>2022-09-23 06:55:32 -0700</bug_when>
    <thetext>*** Bug 245105 has been marked as a duplicate of this bug. ***</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1915178</commentid>
    <comment_count>4</comment_count>
    <who name="Oriol Brufau">obrufau</who>
    <bug_when>2022-11-28 17:27:41 -0800</bug_when>
    <thetext>*** Bug 248442 has been marked as a duplicate of this bug. ***</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1917239</commentid>
    <comment_count>5</comment_count>
    <who name="Oriol Brufau">obrufau</who>
    <bug_when>2022-12-07 08:30:08 -0800</bug_when>
    <thetext>Testcase in comment 0 works well now.
Bug 242775 made it so that only implicit &apos;initial&apos; values would be skipped.
For example, this is still wrong:

    var {style} = document.createElement(&quot;div&quot;);
    style.container = &quot;foo&quot;;
    style.removeProperty(&quot;container-name&quot;);
    style.cssText;

Ideally this should be &quot;container-type: normal;&quot;, but given that style.containerType is &quot;initial&quot; in WebKit, then it should be &quot;container-type: initial;&quot;. However, it&apos;s just empty string.

This remaining problem should be fixed by removing implicit flags (bug 248383).</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1932415</commentid>
    <comment_count>6</comment_count>
    <who name="Oriol Brufau">obrufau</who>
    <bug_when>2023-02-09 12:26:03 -0800</bug_when>
    <thetext>The code skipping implicit initial values was removed in bug 248913.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1932426</commentid>
    <comment_count>7</comment_count>
    <who name="Oriol Brufau">obrufau</who>
    <bug_when>2023-02-09 12:42:22 -0800</bug_when>
    <thetext>*** Bug 245104 has been marked as a duplicate of this bug. ***</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>