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

Issue 756804 link

Starred by 5 users

Issue metadata

Status: Fixed
Owner:
Last visit > 30 days ago
Closed: Aug 2017
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Windows , Mac
Pri: 2
Type: Bug



Sign in to add a comment

When dynamically changing a <style> element’s media attribute from "none" to "all", the CSS is still ignored

Reported by sime.vi...@gmail.com, Aug 18 2017

Issue description

UserAgent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:57.0) Gecko/20100101 Firefox/57.0

Steps to reproduce the problem:
1. Click the 'Switch' button

What is the expected behavior?
The text on the page should become red.

What went wrong?
Chrome still ignores the <style> element, and its CSS styles.

Did this work before? N/A 

Does this work in other browsers? Yes

Chrome version: 62.0.3189.0 (Official Build) canary (64-bit) (cohort: Clang-64)  Channel: canary
OS Version: 10.0
Flash Version: 

Clicking the 'Trim' button will make it work in Chrome. (It’s a hack.) Note that in Firefox, Safari, and Edge, the CSS does become active once the <style media> attribute is set to an active media type, so this is a Chrome-only problem.
 
test.html
1.1 KB View Download
Cc: ligim...@chromium.org
Labels: -Pri-2 Needs-Triage-M60 Needs-Bisect Pri-1
Labels: -Needs-Bisect OS-Mac
Status: Untriaged (was: Unconfirmed)
Not a regression.
WebKit fixed it at some point between Safari 9.1 and Safari 10.1, but I cannot find the exact change set. :(
It would be good to add a reference test in web-platform-test (if one does not exist already) for this case. I took a shot at it (work in progress) -
https://github.com/phistuck/web-platform-tests/blob/style-media-change/css/mediaqueries-3/style-media-change.html

Comment 3 by shans@chromium.org, Aug 21 2017

Labels: -Pri-1 Pri-2
Status: Available (was: Untriaged)

Comment 4 by shans@chromium.org, Aug 21 2017

Labels: Update-Quarterly

Comment 5 by r...@opera.com, Aug 21 2017

This is related to  issue 757450 .

Comment 6 by r...@opera.com, Aug 21 2017

Another related issue is 757452.
Owner: shanmug...@samsung.com
Status: Started (was: Available)

Comment 8 by phistuck@gmail.com, Aug 24 2017

#7 -
You may continue the work I started for adding a test to web-platform-tests for it  (no credit needed) -
https://github.com/phistuck/web-platform-tests/commit/b917c9692382d477b6962f43a7e98f01f0421e6c

Comment 9 by r...@opera.com, Aug 28 2017

Cc: elkurin@google.com shanmug...@samsung.com kochi@chromium.org
 Issue 759420  has been merged into this issue.
Project Member

Comment 10 by bugdroid1@chromium.org, Aug 29 2017

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

commit cbe78d23e79476b05503d6fe028b83addfc45d6e
Author: Shanmuga Pandi M <shanmuga.m@samsung.com>
Date: Tue Aug 29 12:48:36 2017

Changing <style> element's media attribute should reflect is CSS.

CSSStyleSheet is not created for style elements when the media type 
is not matching screen or print earlier.
With this change, it will create style sheet for all media types.

Bug:  756804 ,  759420 ,  757450 
Change-Id: I8c38f2daf6d70b749a0f8de394d646f755695d02
Reviewed-on: https://chromium-review.googlesource.com/631859
Reviewed-by: Rune Lillesveen <rune@opera.com>
Commit-Queue: Shanmuga Pandi <shanmuga.m@samsung.com>
Cr-Commit-Position: refs/heads/master@{#498083}
[add] https://crrev.com/cbe78d23e79476b05503d6fe028b83addfc45d6e/third_party/WebKit/LayoutTests/external/wpt/html/semantics/document-metadata/the-style-element/style_media_change.html
[add] https://crrev.com/cbe78d23e79476b05503d6fe028b83addfc45d6e/third_party/WebKit/LayoutTests/external/wpt/html/semantics/document-metadata/the-style-element/style_non_matching_media.html
[modify] https://crrev.com/cbe78d23e79476b05503d6fe028b83addfc45d6e/third_party/WebKit/Source/core/dom/StyleElement.cpp

Status: Fixed (was: Started)

Sign in to add a comment