Menu

#63 Parsing of content: "\A" corrupts the CSS file

0.9.20
closed
RBRi
None
1
2016-07-23
2016-05-25
Tim Dionne
No

using content: "\A" in a CSS file corrupts the property value, and inserts a newline into the sheet:
This:
.x-panel-reset .x-panel-body br:before { content: "\A" }

Becomes:
.x-panel-reset .x-panel-body br:before { content: "
" }

Discussion

  • RBRi

    RBRi - 2016-05-26
    • status: open --> accepted
    • assigned_to: RBRi
     
  • RBRi

    RBRi - 2016-05-26

    Hi Tim,

    \a is an CSS escape sequence for the newline character. From my point of view it is correct to replace the sequence with the newline.
    Or do you talk about the conversion back to a string?

     
  • RBRi

    RBRi - 2016-05-26

    Hi Tim,
    did some fixes for the text output. Hope that helps.
    A new snapshot build is available.

     
  • Tim Dionne

    Tim Dionne - 2016-05-26

    Thanks!! I will give it a try today. IMO leaving the "\A" intact is the right thing to do, and in fact it causes real problems when browsers read the CSS file with a newline and no closing quote. It renders the following CSS rules ineffective. Do you know if this will make it into 0.9.20?

     
  • RBRi

    RBRi - 2016-05-26

    To make it a bit more clear: in the end the parser creates a LexicalUnit from the string and the unit contains the newline as value .

    If you call getStringValue() for that unit you will get the string containing the newline.

    If you call toString or getCssText you will get a string with the '\a ' inside (the blank is added as normalization like at least FF does).

    This is the way this is already implemented with the current snapshot. If you like it will be part of the next release. If you do not like it we will continue our discussion until we will end up with a more clever solution :-)

     

    Last edit: RBRi 2016-07-23
  • Anonymous

    Anonymous - 2016-06-02

    Thanks RBRi, I took a look finally, and it looks good, although I'm not sure that \a is the same as \A?

     
  • RBRi

    RBRi - 2016-07-23

    Hi Tom,
    guess ou are (more or less) right. Have changed the impl a bit to now always use \A instead of \a when generating the cssText. But the parser still recognices both the same way.
    Looks this is the same the browsers are doing.
    Thanks for the feedback.

     
  • RBRi

    RBRi - 2016-07-23
    • status: accepted --> closed
     

Anonymous
Anonymous

Add attachments
Cancel





Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.