-
Notifications
You must be signed in to change notification settings - Fork 144
added support for merging imported stylesheets #22
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
Conversation
|
||
public function __construct($sText, $sDefaultCharset = 'utf-8') { |
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 constructor now accepts an array of user-defined options.
Parsing now occurs in the parseFile, parseURL adn/or parseString methods.
@@ -45,7 +51,7 @@ class CSSSize extends CSSPrimitiveValue { | |||
*/ | |||
public function isSize() { | |||
$aNonSizeUnits = array('deg', 'grad', 'rad', 'turns', 's', 'ms', 'Hz', 'kHz'); | |||
if(in_array($this->sUnit), $aNonSizeUnits) { | |||
if(in_array($this->sUnit, $aNonSizeUnits)) { |
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.
Oh, how embarassing. I fixed this but forgot to commit.
I’m considering your changes but would like to propose some modifications to keep compatibility with existing API: I want to be able to give all options in the constructor (but also allow a chainable API to set the options) and introduce static methods for createWithURL and createWithFile. You could then use the parser as follows, for example: Other than API, there are some more fundamental issues I see with your solution:
All in all, I’d rather not include the ability to resolve imports than to have it only work correctly if certain constraints are met (both files have the same charset, |
Nope. If you look at the code in the
The
Absolutely. I don't know why I didn't think about it... As for the API, what about this: $oParser->getOption('my_option');
$oParser->setOption('my_option', $myValue)->setOption('other_option', $otherValue);
$oParser->getOptions();
$oParser->setOptions(array(
'my_option' => $myValue,
'other_option' => $otherValue
)); This way the API doesn't change everytime you need to add a new option.
Yep, I understand that. It's a bit out of the topic of this commit though. I should have removed this. |
This check already happens in |
Having read parts of the webkit source code, it seemed to me that browsers only detect the charset of the main stylesheet and apply it to all imported stylesheets. |
Sure From http://www.w3.org/TR/CSS2/syndata.html#charset:
Meaning what your code currently does is what a browser would do if all other means fail. Wo do, however, have two means of charset-detection at our disposal: a possible BOM and |
It seems, however, that I have been wrong about replacing |
Which is the reason why I added |
Yes, I know. But 1. On 11.09.2011, at 10:11, ju1ius reply@reply.github.com wrote:
|
This commit allows to resolve @import rules, merging their declarations into the main stylesheet.
Required a few changes to the API, see the comments.