Config
Table of Contents

Namespace

O.Stylesheet

The O.Stylesheet namespace contains helper functions for dealing with CSS stylesheets.

/*global document */

"use strict";

( function ( NS ) {

NS.Stylesheet = {

Function

O.Stylesheet.create( id, css )

Injects CSS into the document by creating a new stylesheet and appending it to the document.

Parameters

idString The id to give the node in the document.
cssString The CSS to insert into the stylesheet.

Returns

Element The <style> node that was created.

create: function ( id, css ) {
   var doc = document,
     head = doc.documentElement.firstChild,
     style = NS.Element.create( 'style', {
       type: 'text/css',
       id: id
     });

   if ( style.styleSheet ) {
     // IE8: must append to document BEFORE adding styles
     // or you get the IE7 CSS parser!
     head.appendChild( style );
     style.styleSheet.cssText = css;
   } else {
     // Everyone else
     style.appendChild( doc.createTextNode( css ) );
     head.appendChild( style );
   }
   return style;
 }
};

}( O ) );
Animation
Application
Core
DataStore
DOM
DragDrop
Foundation
IO
Localisation
Selection
Parser
TimeZones
Storage
Touch
CollectionViews
UA
ContainerViews
ControlViews
PanelViews
View