-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Shorthand inline CSS properties not saved correctly in the styleObj #1246
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -572,3 +572,13 @@ export function inDom(n: Node): boolean { | |||||
if (!doc) return false; | ||||||
return doc.contains(n) || shadowHostInDom(n); | ||||||
} | ||||||
|
||||||
export function getInlineCSSProperties(value: string | null): string[] { | ||||||
if (!value) { | ||||||
return []; | ||||||
} | ||||||
return value | ||||||
.split(';') | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What if someone does There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You are right, maybe there should be a more complex regex to split these values, some sort of CSSOM or even something extra crazy. Will keep thinking about this. Thanks for the feedback! |
||||||
.map((declaration) => declaration.split(':')[0].trim()) | ||||||
.filter((declaration) => !!declaration); | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Does the same thing but is neater
Suggested change
|
||||||
} |
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.
Note we could just get rid of the
old
variable on line 567 altogether, as we've already gotm.oldValue
corresponding tooldStyle
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.
old
variable on line 567 can be removed if you are not going to be usinggetPropertyValue
orgetPropertyPriority
since it counts onCSSStyleDeclaration
type and string cannot be cast as one, it has to be assigned to a style attribute firstAs for me getting the style attribute on line 579, it was a mistake. I could've just used the
m.oldValue