[ 3 posts ]

Andre Mikulec

  • Offline
  • Profile

insertBefore and sytleoverrides

Post Posted: Sun Jan 10, 2010 11:58 am
+0-
Hi,

Could someone explain to me the logic behind how "insertBefore" should work? How does this affect styles? Out there, does anyone have any (simple or complicated) working examples?


This is what I have so far.
I my have some YUI 3 javascript code like this.

Code:
YUI({
         base: '../yui3/build/', // the base path to the YUI install

         // We can specify a node that is the insertion point for
         // all new nodes.  This
         // is useful for making sure css rules are applied
         // in the correct order.

        // The insertion point for new nodes
         insertBefore: 'sytleoverrides',


Then, I may have some HTML markup like this.

Code:
    <head>
        <style id="styleoverrides"></style>
    </head>


Or Perhaps this.

Code:
    <body>
        <style id="styleoverrides"></style>
    </body>


Thank you.

Dav Glass

  • Username: davglass
  • Joined: Thu Aug 28, 2008 9:28 am
  • Posts: 2088
  • Location: Marion, IL, US
  • Twitter: davglass
  • GitHub: davglass
  • Gists: davglass
  • IRC: davglass
  • Offline
  • Profile

Re: insertBefore and sytleoverrides

Post Posted: Mon Jan 11, 2010 10:48 am
+0-
What that means is that when the YUILoader inserts script and link tags for the library, they will be inserted before that node.

Usually, they are appended to the head. Which means that if you are loading a stylesheet with your own CSS overrides in it. When we load our css it will load before yours so that your overrides will still work.

Make sense?

Andre Mikulec

  • Offline
  • Profile

Re: insertBefore and sytleoverrides

Post Posted: Tue Jan 12, 2010 12:04 am
+0-
I think so.

Regular behavior (without insertBefore)
-----------------------------------------
YUILoader appends script and link tags at the end of the head.


insertBefore behavior (insertBefore: 'styleoverrides')
---------------------------------------------
YUILoader inserts script and link tags before the HTML tag <style id="styleoverrides" type="text/css"></style>.


Thanks.
  [ 3 posts ]
Display posts from previous:  Sort by  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
cron