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
Style sheets #118
Style sheets #118
Conversation
…where a context object already exists
@@ -0,0 +1,17 @@ | |||
# Auto detect text files and perform LF normalization |
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.
Don't include the browser adapter in our repo. It is also available on npm:
https://www.npmjs.com/package/css-select-browser-adapter
src/svg2pdf.js
Outdated
// returns an attribute of a node, either from the node directly or from css | ||
var getAttribute = function (node, propertyNode, propertyCss) { | ||
propertyCss = propertyCss || propertyNode; | ||
var getAttribute = function (node, propertyNames, styleSheets) { |
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.
we could define getAttribute on the context object, as we need a context anyways for this.
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.
Actually I tried to implement it in a way that you can use getAttribute() without any context...
src/svg2pdf.js
Outdated
} | ||
|
||
StyleSheets.loadSheet = function (url) { | ||
const request = new XMLHttpRequest(); |
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.
We could try and use the styleSheets API for this. Don't know if this works, though.
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.
I retried it and couldn't find any styleSheets in the debug.html DOM...
# Conflicts: # karma.conf.js # package-lock.json # package.json # src/applyparseattributes.ts # src/context/context.ts # src/nodes/circle.ts # src/nodes/clippath.ts # src/nodes/containernode.ts # src/nodes/ellipse.ts # src/nodes/geometrynode.ts # src/nodes/group.ts # src/nodes/image.ts # src/nodes/marker.ts # src/nodes/path.ts # src/nodes/pattern.ts # src/nodes/rect.ts # src/nodes/renderednode.ts # src/nodes/svg.ts # src/nodes/svgnode.ts # src/nodes/text.ts # src/nodes/use.ts # src/parse.ts # src/svg2pdf.ts # src/utils/bbox.ts # src/utils/misc.ts # src/utils/node.ts # src/utils/patterngradient.ts # src/utils/svgpathadapter.ts # src/utils/text.ts # test/common/tests.js # test/unit/webpack.config.js # tsconfig.json
Closes #81