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

Parse stylesheet directly #44

Open
gagern opened this issue Jan 8, 2016 · 0 comments
Open

Parse stylesheet directly #44

gagern opened this issue Jan 8, 2016 · 0 comments

Comments

@gagern
Copy link
Collaborator

gagern commented Jan 8, 2016

Since 373dcc8 we duplicate the xml document which contains the stylesheet. For the most common use case, namely that where the xml document is used as a stylesheet and nothing else, this means avoidable overhead. It would be better to combine parsing the stylesheet document and constructing a stylesheet object into a single step, so that we don't have to wrap the xml document for use by node.

Coding this should be reasonably easy, once we have decided what API to expose for this.

The current API should probably remain in place. Should we re-use the same function, and perform some case distinction based on the type of the argument? Interpret it as a document to be parsed if it's a Buffer, and as an already parsed XML document if it's any other object? Should we do an instanceof Document check, or some ducktyping heuristics, to verify it's an XML document?

How about string as input? Should we convert that to a buffer, or interpret it as a file name? Both approaches seem reasonable, which means that both will likely confuse some users who expect the other.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant