Skip to content

Commit

Permalink
fix: allow spaces surrounding url
Browse files Browse the repository at this point in the history
  • Loading branch information
cdoublev committed May 3, 2021
1 parent 7284d37 commit 0e42fb2
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
6 changes: 6 additions & 0 deletions lib/CSSStyleDeclaration.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -437,6 +437,12 @@ describe('CSSStyleDeclaration', () => {
expect(style.backgroundImage).toEqual('url(http://some/url/here3.png)');
});

test('url parsing works surrounded by spaces', () => {
var style = new CSSStyleDeclaration();
style.backgroundImage = 'url( http://some/url/here1.png )';
expect(style.backgroundImage).toEqual('url(http://some/url/here1.png)');
});

test('setting 0 to a padding or margin works', () => {
var style = new CSSStyleDeclaration();
style.padding = 0;
Expand Down
1 change: 1 addition & 0 deletions lib/parsers.js
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,7 @@ exports.parseUrl = function parseUrl(val) {
if (str[0] === '"' || str[0] === "'") {
str = str.substr(1, str.length - 2);
}
str = str.trim();

var i;
for (i = 0; i < str.length; i++) {
Expand Down

0 comments on commit 0e42fb2

Please sign in to comment.