Let's say I create an html document in js:
var myHtmlDoc = document.createElement('html');
And then assign it is some html with '@page' defined:
myHtmlDoc.innerHTML = '<html><head><style>@page {size: 320mm 120mm;margin: 10mm;}</style></head><body></body></html>';
Spaced/indented html from above quote for readability:
<html>
<head>
<style>
@page {
size: 320mm 120mm;
margin: 10mm;
}
</style>
</head>
<body>
</body>
</html>
Let's say I want to get the "size" and "margin" values out of myHtmlDoc
(which I won't be defining by hand) and assign them to variables. How would I do that with raw javascript and/or jQuery?
Attempted solutions:
Tried the solution shown in this plunk from the answer here: Find all CSS rules that apply to an element - this causes an error if used with @page:
Uncaught SyntaxError: Failed to execute 'matches' on 'Element': '@page' is not a valid selector.
Will be updating the question with things that work/don't work.