My HTML Data is as below. i have an import statement in Style Tag. I want to extract the CSS styles from the same and all the styles i want to apply only to the div tag with id second.
<!DOCTYPE html>
    <html>
    <head>
        <style>
            @import url(http://www.htmlhelp.com/style.css);
            p {color:green;}
        </style>
    </head>
    <body>
        <div id="first";>
            <h1>I am formatted with a linked style sheet h1 tag</h1>
            <p>Me too! p tag</p>
        </div>
         <div id="second";>
            <h1>Second Data h1</h1>
            <p>Second data p</p>
        </div>
    </body>
</html>
i checked Javascript Firefox - Unable to query cssRules if @import is present in stylesheet- bug or expected behavior? for reference, but is not working in my case. can anyone suggest me a solution or hint to work on.