JavaScript Isolate css scope isolate scope angularjs,isolate scope in angularjs directive example,isolate

For a very mysterious reason, I have to limit the scope of a css file only to an element:

<html>
    <head>
        <link rel="stylesheet" type="text/css" target='_blank' href="one.css">
    </head>
    <body>
        <div id="first-container">
        </div>

        <div id="second-container">
            <link rel="stylesheet" type="text/css" target='_blank' href="two.css">
        </div>
    </body>
</html>

The rules in one.css should be applied as usual, while the rules in two.css should be scoped to the div#second-container only.

That is exactly what the attribute scoped attribute should do: http://w3c.github.io/html-reference/style.html#style.attrs.scoped , but is not currently supported (and it will never be) http://caniuse.com/#search=scoped .

I've tried to isolate scope with a regex (CSS are 10K+ lines minified), but it didn't work out well.

Any solution (or dirty workaround) for a strange use case like this?

I can use one of these way:

  • one shot solution: some sed magic on two.css which prepends everything with div#sed-container
  • server side solution: some magic with php
  • client side solution: some magic with js, without making extra sever call (i.e.: AJAX)
Answer:1

It might be a little complicated but this comes to my mind:

1) Create invisible iframe element anc copy content of div to it

var i = document.createElement('iframe');
i.style.display = 'none';
i.src = "data:text/html;charset=utf-8," + document.querySelector('#secondDiv').innerHTML;
document.body.appendChild(i);

2) Apply style in iframe

var cssLink = document.createElement("link") 
cssLink.href = "style.css"; 
cssLink.rel = "stylesheet"; 
cssLink.type = "text/css"; 
frames['iframe'].document.body.appendChild(cssLink);

3) Inline style of html in iframe.

4) Copy it back to div from iframe.

Answer:2

I'm setting up my model incorrectly here somehow and I can't see it. I've looked at this issue: Node.js - Mongoose path validation failing - TypeError: Cannot call method 'validate' of ...

I'm setting up my model incorrectly here somehow and I can't see it. I've looked at this issue: Node.js - Mongoose path validation failing - TypeError: Cannot call method 'validate' of ...

  1. cannot read property of undefined
  2. cannot read property 'length' of undefined
  3. cannot read property 'setstate' of undefined
  4. cannot read property 'push' of undefined
  5. cannot read property 'map' of undefined
  6. cannot read property 'addeventlistener' of null
  7. cannot read property 'match' of undefined
  8. cannot read property 'then' of undefined
  9. cannot read property '0' of undefined
  10. cannot read property 'props' of undefined
  11. cannot read property 'nativeelement' of undefined
  12. cannot read property 'tolowercase' of undefined
  13. cannot read property 'state' of undefined
  14. cannot read property 'foreach' of undefined
  15. cannot read property 'split' of undefined
  16. cannot read property of null
  17. cannot read property 'replace' of undefined
  18. cannot read property 'summary' of undefined
  19. cannot read property 'createelement' of undefined
  20. cannot read property 'subscribe' of undefined

I am beginning to connect my store to mobx. I wonder the difference between the use of observer(['store'],...) or the use of inject('store')(observer(...)) The main difference I see it that inject is ...

I am beginning to connect my store to mobx. I wonder the difference between the use of observer(['store'],...) or the use of inject('store')(observer(...)) The main difference I see it that inject is ...

  1. what main difference between prokaryotes and eukaryotes
  2. what main difference between cytokinesis in plants and animals
  3. what main difference between c and c++
  4. what main difference between fungi and plants
  5. what main difference between speed and velocity
  6. what main difference between lava and magma
  7. what is main difference between the sat-i and sat-ii
  8. what is main difference between male and female cockroach
  9. what is main difference between the sat-i and sat-ii brainly
  10. what the main difference between judaism and christianity
  11. what the main difference between mitosis and meiosis

Is there a way to add custom font in React Native in Atom editor and not using Xcode?

Is there a way to add custom font in React Native in Atom editor and not using Xcode?

  1. custom font react native
  2. custom font react native 0.60
  3. custom font react native expo
  4. custom font react native android
  5. custom font react native ios
  6. custom font react js
  7. custom font react native 0.61
  8. custom font react
  9. custom font react-native-vector-icons
  10. add custom font react native
  11. use custom font react native
  12. custom font family react native
  13. load custom font react native
  14. add custom font react native ios
  15. add custom font react native android
  16. install custom font react native
  17. import custom font react native
  18. add custom font react
  19. use custom font react
  20. import custom font react

I am developing JavaFx application with WebView loaded some HTML and Java Script. I have tried FireBug Lite for debug purpose, but its not letting to debug the JavaScript. Is there any way to debug ...

I am developing JavaFx application with WebView loaded some HTML and Java Script. I have tried FireBug Lite for debug purpose, but its not letting to debug the JavaScript. Is there any way to debug ...

  1. debug javascript webview android
  2. debug webview javascript
  3. android studio debug webview javascript
  4. react native debug webview javascript