Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

style values being ignored if there's trailing whitespace #252

Closed
dmeatte opened this Issue · 0 comments

2 participants

@dmeatte

If I convert html with a style like ".c2 { font-family: 'Trebuchet MS'; font-size: 16px; font-style: italic }" to an ns attributed string, the space after italic isn't trimmed off. This causes DHTMLElement's applyStyleDictionary: to miss the attribute since it doesn't trim the trailing whitespace off before it compares it to it's string constants.

I fixed this by adding a string trim to the value in scanCSSAttribute:value: inside NSScanner+HTML.m

@Cocoanetics Cocoanetics referenced this issue from a commit
@Cocoanetics Added unit test for #252
To DO: Modify NSScanner+HTML to properly de-quote the font and remove the whitespace on italic
86fb2ee
@Cocoanetics Cocoanetics closed this issue from a commit
@Cocoanetics improved CSS scanning
- now both single and double quotes are recognized
- attribute values that are not quoted are now concatenated until a semicolon is encountered or the end of the string is reached
- previously 'font name' would not remove the quotes
- also an attribute with trailing whitespace would need to be trimmed

Closes #252

Note: I would like to replaces all the NSScanner stuff for CSS syntax with a proper parser. Anybody interested in helping there?
8c84707
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.