Permalink
Browse files

renamed the css and js private functions to ejs.loadCSS and ejs.loadJS

  • Loading branch information...
1 parent 6de7816 commit 913b870befa6f9086f59e0e1b9ed7719d6ecae79 scottjehl committed Apr 18, 2012
Showing with 7 additions and 7 deletions.
  1. +4 −4 README.md
  2. +3 −3 enhance.js
View
@@ -93,16 +93,16 @@ Enhance has a few more methods that you might use.
ejs.load( "files/js/foo.js" );
-- `js`: Load a single JavaScript file. Useful if JS filetype can not be guessed by filetype. Example:
+- `loadJS`: Load a single JavaScript file. Useful if JS filetype can not be guessed by filetype. Example:
// Load a single JavaScript file
- ejs.css( "files/js/foo.php" );
+ ejs.loadJS( "files/js/foo.php" );
-- `css`: Load a single CSS file**. Useful if JS filetype can not be guessed by filetype. Example:
+- `loadCSS`: Load a single CSS file**. Useful if JS filetype can not be guessed by filetype. Example:
// Load a single CSS file
- ejs.css( "files/css/foo.php" );
+ ejs.loadCSS( "files/css/foo.php" );
** Note: dynamically loaded CSS is not guaranteed to render before the page content begins visually rendering (and thus, can cause a FOUC). Don't depend on it for styles that need to be there during initial page load.
View
@@ -48,7 +48,7 @@
//private style load function
- function css( href, media ){
+ ejs.loadCSS = function( href, media ){
var lk = doc.createElement( "link" ),
links = head.getElementsByTagName( "link" ),
lastlink = links[ links.length-1 ];
@@ -69,7 +69,7 @@
};
// Private script load function
- function js( src ){
+ ejs.loadJS = function( src ){
var script = doc.createElement( "script" ),
fc = head.firstChild;
script.src = src;
@@ -107,7 +107,7 @@
// CSS and JS loading functions: load CSS or JS via single ejs.load method
ejs.load = function ( url ){
- return ( url.indexOf( ".js" ) > -1 ? js : css )( url );
+ return ( url.indexOf( ".js" ) > -1 ? ejs.loadJS : ejs.loadCSS )( url );
};
// Function for triggering the CSS and JS requests

0 comments on commit 913b870

Please sign in to comment.