diegoles / closure-library

Automatically exported from code.google.com/p/closure-library
0 stars 0 forks source link

style.js parseStyleAttribute fails when a style attribute has a url with a protocol in it #454

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago

What steps will reproduce the problem?
1.var cssObj = goog.style.parseStyleAttribute('left: 0px; text-align: center; 
background-image: url(http://www.google.ca/Test.gif);');

What is the expected output? What do you see instead?
I expect cssObj == {left: "0px", textAlign: "center", backgroundImage: 
"url(http://www.google.ca/Test.gif)"} 
Instead cssObj == {left: "0px", textAlign: "center"} 

What version of the product are you using? On what operating system?
Chrome 18.0.1025.163 on OS X 10.7.3

Please provide any additional information below.
There is a problem with the regex on line 1765 in style.js which is causing it 
to split the background-image value on both colons (the one after the property 
and the one in the url).
I have updated the regex to address this problem and have attached a patch to 
this issue with the updated style.js as well as an updated test in 
style_test.html which tests for this scenario.

Original issue reported on code.google.com by bob.silv...@gmail.com on 21 Apr 2012 at 1:36

GoogleCodeExporter commented 8 years ago
Here's a better patch, as there are other circumstances in which a css property 
value can have a colon in it (e.g., IE's filter property). This patch uses only 
the first colon found as a delimiter between property name and value.

Original comment by bob.silv...@gmail.com on 22 Apr 2012 at 2:45

GoogleCodeExporter commented 8 years ago
It turns out that property values can contain both a colon and a semicolon, 
either of which will cause the current implementation of parseStyleAttribute to 
fail. I have created a new patch which addresses these issues and have attached 
it to a code review ticket: http://codereview.appspot.com/6115045/

Original comment by bob.silv...@gmail.com on 24 Apr 2012 at 1:41

GoogleCodeExporter commented 8 years ago

Original comment by chrishe...@google.com on 11 May 2012 at 8:25

GoogleCodeExporter commented 8 years ago
Hi
Is it normal that this patch is not in the repo 
https://code.google.com/p/closure-library/source/checkout
The bug remains...

Original comment by alexandr...@gmail.com on 19 Aug 2013 at 8:08