-
Notifications
You must be signed in to change notification settings - Fork 85
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
Strip 'px' from numeric values when inlining table,td,th height and width attributes #93
Conversation
lib/setTableAttrs.js
Outdated
$el.attr(styleToAttrMap[style], styleVal); | ||
$el.attr( | ||
styleToAttrMap[style], | ||
(attributesToRemovePxFrom.indexOf(style) > -1) |
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.
This is a style issue but I think there is a better way to handle this. Maybe create a variable for it? I don't like including the ternary assignment here or splitting it into multiple lines like that.
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'm not married to it. You prefer if statements to ternaries?
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.
Updated in master :)
@@ -5,7 +5,7 @@ | |||
background-color: red; | |||
float: left; | |||
width: 100%; | |||
height: 500px; | |||
height: 500PX; |
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.
Why is this change needed?
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.
The regex to replace px values is case insensitive. This tests that PX
which is valid CSS will also be removed.
Lint task is failing so the build is failing now. 😄 |
Fixed 😄 |
Correct format for inlining these values is width="200" vs width="200px". This PR handles case insensitive stripping of 'px' from the end of the attribute value when the key is height or width.