Skip to content
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

Merged
merged 3 commits into from
Jan 13, 2020

Conversation

ryantate13
Copy link
Contributor

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.

@coveralls
Copy link

coveralls commented Dec 13, 2019

Coverage Status

Coverage increased (+0.02%) to 99.043% when pulling eb9b11e on ryantate13:master into c7300fc on jonkemp:master.

$el.attr(styleToAttrMap[style], styleVal);
$el.attr(
styleToAttrMap[style],
(attributesToRemovePxFrom.indexOf(style) > -1)
Copy link
Owner

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.

Copy link
Contributor Author

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?

Copy link
Contributor Author

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;
Copy link
Owner

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?

Copy link
Contributor Author

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.

@jonkemp
Copy link
Owner

jonkemp commented Jan 9, 2020

Lint task is failing so the build is failing now. 😄

@ryantate13
Copy link
Contributor Author

Lint task is failing so the build is failing now. 😄

Fixed 😄

@jonkemp jonkemp merged commit 8c608f7 into jonkemp:master Jan 13, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants