-
-
Notifications
You must be signed in to change notification settings - Fork 69
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
An alternative fix for PR#47 - Add support for numeric values passed to ‘border-spacing’, e.g. ‘border-spacing: 0’ #52
Conversation
@lsiu can you rebase this on master? Hopefully that would increase the chances of getting this merged. I have a rebased version of your branch ready at https://github.com/eddies/CSSStyleDeclaration/tree/pr-47-rebase, but I don't want to duplicate your PR |
…ng’, e.g. ‘border-spacing: 0’. Include test.
If you refer to the w3c border-spacing spec, you can see the "initial value" is 0, not "0", so I suppose a numerical value is also a valid, and should be taken into consideration. |
lib/properties/borderSpacing.js
Outdated
@@ -10,6 +10,9 @@ var parse = function parse(v) { | |||
if (v === '' || v === null) { | |||
return undefined; | |||
} | |||
if (typeof v === 'number') { | |||
v = String(v) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think return undefined
makes more sense to mimic the current browser behaviour.
Browsers do not seem to support this functionality. Tested in Chrome, FF, Safari, Edge: var table = document.createElement('table')
console.log(table.style.borderSpacing); // ""
table.style.setProperty('border-spacing', 10);
console.log(table.style.borderSpacing); // ""
table.style.setProperty('border-spacing', '10');
console.log(table.style.borderSpacing); // ""
table.style.setProperty('border-spacing', '10px');
console.log(table.style.borderSpacing); // 10px Instead of converting the value, I think it would make more sense to return if the value is not a string. |
@jsakas In Firefox 61.0 (OS X):
Moreover, in Firefox, Chrome (67) and Safari (11.1.1), I observe the following:
So I don't think a blanket |
The previous `npm test` script executed a `.sh` file that isn't natively supported by Windows. Since the actual code inside the `.sh` is pretty small, it can be completely embedded inside a `npm` script instead, making it cross-platform and more straight-forward.
@eddies interesting, it seems to work for |
This fix include a test and follow the approach used in padding.js