New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 686686 link

Starred by 2 users

Issue metadata

Status: Fixed
Owner: ----
Closed: Apr 2017
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: All
Pri: 2
Type: Bug



Sign in to add a comment

Mutating elm.style should not remove style="" content attribute

Project Member Reported by zcorpan@gmail.com, Jan 30 2017

Issue description

From https://github.com/whatwg/html/issues/2306#issuecomment-276035317

Test: http://software.hixie.ch/utilities/js/live-dom-viewer/?saved=4846 (expect log: true)

<!DOCTYPE html>
<div style="color: red">one</div>
<script>
  var div = document.querySelector('div');
  div.style.color = "";
  w(div.hasAttribute('style'));
</script>

Chromium removes the style content attribute. Edge, Gecko and WebKit do not.


Spec https://drafts.csswg.org/cssom/#the-elementcssinlinestyle-interface says

> Mutating the declarations must set the style content attribute on the context object to the serialization of the declarations.

Serializing an empty declarations is "", so you should set style to "".
 

Comment 1 by eco...@igalia.com, Jan 30 2017

Cc: eco...@igalia.com
Labels: Needs-Bisect
Confirmed on 56 and nightly.

Comment 3 by ajha@chromium.org, Jan 31 2017

Labels: Needs-Triage-M56
Cc: kavvaru@chromium.org
Labels: Needs-Feedback
Tested the issue on windows 7, Linux Ubuntu 14.04 and Mac 10.12.2 using chrome version 56.0.2924.76 and 58.0.2997.0 with the below steps

1. Created the html file with the given code snippet
2.Opened html file got the output as "one"
3.Observed the error in console

Please find the attached screen shot and provide us the expected behavior to triage the issue from test team end.

Thanks,
686686.png
108 KB View Download

Comment 5 by zcorpan@gmail.com, Jan 31 2017

You need to test http://software.hixie.ch/utilities/js/live-dom-viewer/?saved=4846 or change "w(" to "console.log(" if testing standalone. Expected to log `true`.
Labels: -Needs-Feedback
Kalpana, please bisect.
Labels: -Type-Bug -Pri-3 -Needs-Bisect -Needs-Triage-M56 M-58 hasbisect Pri-1 Type-Bug-Regression
Owner: chrishtr@chromium.org
Status: Assigned (was: Untriaged)
Able to reproduce the issue on windows 7, Linux Ubuntu 14.04 and Mac 10.12.2 using chrome version 56.0.2924.76 and canary 58.0.2997.0.
This is regression issue broken on M34. Please find the bisect information as below

Narrow Bisect::
Good ::34.0.1759.0  --  (official build 242366)
Bad:: 34.0.1760.0  --  (official build 242452)

CHANGELOG URL:  https://chromium.googlesource.com/chromium/src/+log/c5f1ad0332281e65a16842bb92bd09e4044779ba..81704388221bd8f081565e963c4d3ac34f05d587


BLINK CHANGELOG URL:  http://build.chromium.org/f/chromium/perf/dashboard/ui/changelog_blink.html?url=/trunk&range=164307%3A164306

Blink CL giving an empty page.hence providing manual Blink CL from omahaproxy.
Omahaproxy Blink CL::
https://chromium.googlesource.com/chromium/blink/+log/ab2c9924faf7cf35ea2c13f5f8fbc58200c5d363..7fac5d3e615d562a599923cd3ebb45dca5a41724?pretty=fuller&n=10000

Possible suspect::
https://codereview.chromium.org/119533003

chrishtr@ could you please look into this issue if it is related to your change,else please help us in finding the appropriate owner for this issue.

Thanks,
Owner: ----
Status: Untriaged (was: Assigned)
This was the intended purpose of my original CL (well, not that it is developer-
visible, but that it removes the style). I landed it as an optimization to
help improve performance of style recalc, because mutable local style defeats some
of the style optimizations (at least it did at the time I wrote this patch).

Marking as untriaged for the style team to decide what to do with this bug.
Labels: -Pri-1 -Type-Bug-Regression Regressed-34 Pri-2 Type-Bug
Status: Available (was: Untriaged)
This has been around for so long I'm removing the regression label.

Marking as available for style team to pick up.
Labels: Update-Quarterly
Can can probably swap with an immutable empty inline style instead? Then change the inlineStyle() checks to look for mutability instead.

WebKit actually changed their behavior to cache inline styles in the MatchedPropertiesCache too avoiding the need to disable some optimizations here, so we might consider that as a follow up.
Project Member

Comment 12 by bugdroid1@chromium.org, Apr 18 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/4e41fe9e3515a33dc5482e2d628456beb4bd65ef

commit 4e41fe9e3515a33dc5482e2d628456beb4bd65ef
Author: ecobos <ecobos@igalia.com>
Date: Tue Apr 18 08:57:26 2017

Ensure we never remove the style attribute when syncing it from CSSOM.

This makes us align with other browsers when, editing the style attribute, and
also with the spec, per[1]:

> Mutating the declarations must set the style content attribute on the context
> object to the serialization of the declarations

See also [2].

Note that this behavior also affects editing. I've just updated the editing
tests.

[1]: https://drafts.csswg.org/cssom/#the-elementcssinlinestyle-interface
[2]: https://github.com/whatwg/html/issues/2306

BUG= 686686 

Review-Url: https://codereview.chromium.org/2800723002
Cr-Commit-Position: refs/heads/master@{#465181}

[modify] https://crrev.com/4e41fe9e3515a33dc5482e2d628456beb4bd65ef/third_party/WebKit/LayoutTests/custom-elements/spec/callback.html
[modify] https://crrev.com/4e41fe9e3515a33dc5482e2d628456beb4bd65ef/third_party/WebKit/LayoutTests/editing/execCommand/5770834-1-expected.txt
[modify] https://crrev.com/4e41fe9e3515a33dc5482e2d628456beb4bd65ef/third_party/WebKit/LayoutTests/editing/execCommand/empty-span-removal-expected.txt
[modify] https://crrev.com/4e41fe9e3515a33dc5482e2d628456beb4bd65ef/third_party/WebKit/LayoutTests/editing/execCommand/remove-format-multiple-elements-mac-expected.txt
[modify] https://crrev.com/4e41fe9e3515a33dc5482e2d628456beb4bd65ef/third_party/WebKit/LayoutTests/editing/execCommand/remove-format-multiple-elements-win-expected.txt
[modify] https://crrev.com/4e41fe9e3515a33dc5482e2d628456beb4bd65ef/third_party/WebKit/LayoutTests/editing/execCommand/script-tests/empty-span-removal.js
[modify] https://crrev.com/4e41fe9e3515a33dc5482e2d628456beb4bd65ef/third_party/WebKit/LayoutTests/editing/execCommand/script-tests/remove-format-multiple-elements-mac.js
[modify] https://crrev.com/4e41fe9e3515a33dc5482e2d628456beb4bd65ef/third_party/WebKit/LayoutTests/editing/execCommand/script-tests/remove-format-multiple-elements-win.js
[modify] https://crrev.com/4e41fe9e3515a33dc5482e2d628456beb4bd65ef/third_party/WebKit/LayoutTests/editing/execCommand/script-tests/toggle-compound-styles.js
[modify] https://crrev.com/4e41fe9e3515a33dc5482e2d628456beb4bd65ef/third_party/WebKit/LayoutTests/editing/execCommand/script-tests/toggle-style-2.js
[modify] https://crrev.com/4e41fe9e3515a33dc5482e2d628456beb4bd65ef/third_party/WebKit/LayoutTests/editing/execCommand/toggle-compound-styles-expected.txt
[modify] https://crrev.com/4e41fe9e3515a33dc5482e2d628456beb4bd65ef/third_party/WebKit/LayoutTests/editing/execCommand/toggle-style-2-expected.txt
[modify] https://crrev.com/4e41fe9e3515a33dc5482e2d628456beb4bd65ef/third_party/WebKit/LayoutTests/editing/selection/mouse/click-left-of-rtl-wrapping-text.html
[modify] https://crrev.com/4e41fe9e3515a33dc5482e2d628456beb4bd65ef/third_party/WebKit/LayoutTests/editing/style/inline-style-container-expected.txt
[modify] https://crrev.com/4e41fe9e3515a33dc5482e2d628456beb4bd65ef/third_party/WebKit/LayoutTests/editing/style/push-down-font-styles-mac-expected.txt
[modify] https://crrev.com/4e41fe9e3515a33dc5482e2d628456beb4bd65ef/third_party/WebKit/LayoutTests/editing/style/push-down-font-styles-win-expected.txt
[modify] https://crrev.com/4e41fe9e3515a33dc5482e2d628456beb4bd65ef/third_party/WebKit/LayoutTests/editing/style/push-down-implicit-styles-around-list-mac-expected.txt
[modify] https://crrev.com/4e41fe9e3515a33dc5482e2d628456beb4bd65ef/third_party/WebKit/LayoutTests/editing/style/push-down-implicit-styles-around-list-win-expected.txt
[modify] https://crrev.com/4e41fe9e3515a33dc5482e2d628456beb4bd65ef/third_party/WebKit/LayoutTests/editing/style/push-down-implicit-styles-mac-expected.txt
[modify] https://crrev.com/4e41fe9e3515a33dc5482e2d628456beb4bd65ef/third_party/WebKit/LayoutTests/editing/style/push-down-inline-styles-expected.txt
[modify] https://crrev.com/4e41fe9e3515a33dc5482e2d628456beb4bd65ef/third_party/WebKit/LayoutTests/editing/style/script-tests/inline-style-container.js
[modify] https://crrev.com/4e41fe9e3515a33dc5482e2d628456beb4bd65ef/third_party/WebKit/LayoutTests/editing/style/script-tests/push-down-font-styles-mac.js
[modify] https://crrev.com/4e41fe9e3515a33dc5482e2d628456beb4bd65ef/third_party/WebKit/LayoutTests/editing/style/script-tests/push-down-font-styles-win.js
[modify] https://crrev.com/4e41fe9e3515a33dc5482e2d628456beb4bd65ef/third_party/WebKit/LayoutTests/editing/style/script-tests/push-down-implicit-styles-around-list-mac.js
[modify] https://crrev.com/4e41fe9e3515a33dc5482e2d628456beb4bd65ef/third_party/WebKit/LayoutTests/editing/style/script-tests/push-down-implicit-styles-around-list-win.js
[modify] https://crrev.com/4e41fe9e3515a33dc5482e2d628456beb4bd65ef/third_party/WebKit/LayoutTests/editing/style/script-tests/push-down-implicit-styles-mac.js
[modify] https://crrev.com/4e41fe9e3515a33dc5482e2d628456beb4bd65ef/third_party/WebKit/LayoutTests/editing/style/script-tests/push-down-inline-styles.js
[modify] https://crrev.com/4e41fe9e3515a33dc5482e2d628456beb4bd65ef/third_party/WebKit/LayoutTests/editing/style/toggle-style-bold-italic-mixed-editability.html
[modify] https://crrev.com/4e41fe9e3515a33dc5482e2d628456beb4bd65ef/third_party/WebKit/LayoutTests/editing/style/toggle-style-bold-italic.html
[modify] https://crrev.com/4e41fe9e3515a33dc5482e2d628456beb4bd65ef/third_party/WebKit/LayoutTests/editing/style/typing_style.html
[modify] https://crrev.com/4e41fe9e3515a33dc5482e2d628456beb4bd65ef/third_party/WebKit/LayoutTests/editing/undo/remove-css-property-and-remove-style-expected.txt
[modify] https://crrev.com/4e41fe9e3515a33dc5482e2d628456beb4bd65ef/third_party/WebKit/LayoutTests/editing/undo/remove-css-property-and-remove-style.html
[delete] https://crrev.com/7e377438d1c86ec06009e10d24a88ea84342e594/third_party/WebKit/LayoutTests/external/wpt/cssom/css-style-attribute-modifications-expected.txt
[modify] https://crrev.com/4e41fe9e3515a33dc5482e2d628456beb4bd65ef/third_party/WebKit/LayoutTests/external/wpt/editing/run/backcolor-expected.txt
[modify] https://crrev.com/4e41fe9e3515a33dc5482e2d628456beb4bd65ef/third_party/WebKit/LayoutTests/external/wpt/editing/run/fontsize-expected.txt
[modify] https://crrev.com/4e41fe9e3515a33dc5482e2d628456beb4bd65ef/third_party/WebKit/LayoutTests/external/wpt/editing/run/forecolor-expected.txt
[modify] https://crrev.com/4e41fe9e3515a33dc5482e2d628456beb4bd65ef/third_party/WebKit/LayoutTests/external/wpt/editing/run/hilitecolor-expected.txt
[modify] https://crrev.com/4e41fe9e3515a33dc5482e2d628456beb4bd65ef/third_party/WebKit/LayoutTests/external/wpt/editing/run/removeformat-expected.txt
[add] https://crrev.com/4e41fe9e3515a33dc5482e2d628456beb4bd65ef/third_party/WebKit/LayoutTests/fast/css/css-style-attribute-modifications.html
[modify] https://crrev.com/4e41fe9e3515a33dc5482e2d628456beb4bd65ef/third_party/WebKit/LayoutTests/fast/events/inputevents/inputevent-execcommand.html
[rename] https://crrev.com/4e41fe9e3515a33dc5482e2d628456beb4bd65ef/third_party/WebKit/LayoutTests/platform/mac/external/wpt/editing/run/bold-expected.txt
[modify] https://crrev.com/4e41fe9e3515a33dc5482e2d628456beb4bd65ef/third_party/WebKit/LayoutTests/platform/mac/external/wpt/editing/run/italic-expected.txt
[rename] https://crrev.com/4e41fe9e3515a33dc5482e2d628456beb4bd65ef/third_party/WebKit/LayoutTests/platform/mac/external/wpt/editing/run/justifycenter-expected.txt
[rename] https://crrev.com/4e41fe9e3515a33dc5482e2d628456beb4bd65ef/third_party/WebKit/LayoutTests/platform/mac/external/wpt/editing/run/justifyfull-expected.txt
[rename] https://crrev.com/4e41fe9e3515a33dc5482e2d628456beb4bd65ef/third_party/WebKit/LayoutTests/platform/mac/external/wpt/editing/run/justifyright-expected.txt
[modify] https://crrev.com/4e41fe9e3515a33dc5482e2d628456beb4bd65ef/third_party/WebKit/LayoutTests/platform/mac/external/wpt/editing/run/strikethrough-expected.txt
[modify] https://crrev.com/4e41fe9e3515a33dc5482e2d628456beb4bd65ef/third_party/WebKit/LayoutTests/platform/mac/external/wpt/editing/run/underline-expected.txt
[modify] https://crrev.com/4e41fe9e3515a33dc5482e2d628456beb4bd65ef/third_party/WebKit/LayoutTests/platform/win/external/wpt/editing/run/bold-expected.txt
[modify] https://crrev.com/4e41fe9e3515a33dc5482e2d628456beb4bd65ef/third_party/WebKit/LayoutTests/platform/win/external/wpt/editing/run/italic-expected.txt
[modify] https://crrev.com/4e41fe9e3515a33dc5482e2d628456beb4bd65ef/third_party/WebKit/LayoutTests/platform/win/external/wpt/editing/run/justifycenter-expected.txt
[modify] https://crrev.com/4e41fe9e3515a33dc5482e2d628456beb4bd65ef/third_party/WebKit/LayoutTests/platform/win/external/wpt/editing/run/justifyfull-expected.txt
[modify] https://crrev.com/4e41fe9e3515a33dc5482e2d628456beb4bd65ef/third_party/WebKit/LayoutTests/platform/win/external/wpt/editing/run/justifyright-expected.txt
[modify] https://crrev.com/4e41fe9e3515a33dc5482e2d628456beb4bd65ef/third_party/WebKit/LayoutTests/platform/win/external/wpt/editing/run/strikethrough-expected.txt
[modify] https://crrev.com/4e41fe9e3515a33dc5482e2d628456beb4bd65ef/third_party/WebKit/LayoutTests/platform/win/external/wpt/editing/run/underline-expected.txt
[modify] https://crrev.com/4e41fe9e3515a33dc5482e2d628456beb4bd65ef/third_party/WebKit/Source/core/dom/Element.cpp

Comment 13 by eco...@igalia.com, Apr 19 2017

Status: Fixed (was: Available)
This should be fixed now.

Sign in to add a comment