Ruby on Rails | Screencasts | Download | Documentation | Weblog | Community | Source

Ticket #10046: head_insert.diff

File head_insert.diff, 0.8 kB (added by kangax, 8 months ago)

a little shorter insertion

  • scriptaculous.js

    old new  
    2424var Scriptaculous = { 
    2525  Version: '1.8.0_pre1', 
    2626  require: function(libraryName) { 
    27     // inserting via DOM fails in Safari 2.0, so brute force approach 
    28     document.write('<script type="text/javascript" src="'+libraryName+'"><\/script>'); 
     27    try { 
     28      $$('head')[0].insert(new Element('script', {type: 'text/javascript', src: libraryName})); 
     29    } catch(e) { 
     30      // inserting via DOM fails in Safari 2.0, so brute force approach 
     31      document.write('<script type="text/javascript" src="'+libraryName+'"><\/script>'); 
     32    } 
    2933  }, 
    3034  REQUIRED_PROTOTYPE: '1.6.0', 
    3135  load: function() {