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

Properly clone nodes in ignoredAtRules #24

Merged
merged 1 commit into from
Feb 13, 2015
Merged

Conversation

iamvdo
Copy link
Contributor

@iamvdo iamvdo commented Feb 12, 2015

(fix #21 when parent is undefined)

(fix postcss#21 when `parent` is undefined)
ignoredAtRules.push([atRule, parsedAtImport])
var atRuleCloned = atRule.clone()
atRuleCloned.parent = atRule.parent.clone()
ignoredAtRules.push([atRuleCloned, parsedAtImport])
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we need this weird "clone but not really" ?

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 found out that atRule.removeSelf() changes the rule previously stored in ignoredAtRules. So I chose to clone node before storing it. I also cloned parent property because the clone() method doesn't make it.
Do you think of another way to do it ?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't really know (or remember) why we do need a parent ref, but anyway, this is fixing a bug, with a test, so merging ^^

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep. Can you release a patch ?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am working a more stable release, but encountering too many weird behavior. This postcss API is starting to break my balls.

I will release a patch asap.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK ;)

MoOx added a commit that referenced this pull request Feb 13, 2015
Properly clone nodes in `ignoredAtRules`
@MoOx MoOx merged commit 27db4b2 into postcss:master Feb 13, 2015
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.

TypeError when using @import for local and remote stylesheets
2 participants