maxtaco / coffee-script

IcedCoffeeScript
http://maxtaco.github.com/coffee-script
MIT License
727 stars 58 forks source link

Cannot use html 'defer' attribute #111

Closed antoinegoutagny closed 10 years ago

antoinegoutagny commented 10 years ago

I'm inserting a script node to the document, and would like to set its defer property. Unfortunately, the compiler throws an error. The following lines throw the error:

Error: Parse error on line 3: Unexpected '='

Which makes sense since defer is a keyword in ICS. Is there any way to fix this, or is ICS simply incompatible with this attribute?

script = document.createElement('script')
script.type = 'text/javascript';
script.defer = true
script.async = true
script.src = "//initrode.com/scripts/myscript.js"

I'm using the compiler included in Visual Studio 2012 Web Essentials 3.6.5.

vjpr commented 10 years ago

Try script['defer'] = true

antoinegoutagny commented 10 years ago

I hadn't thought of that, thanks a lot!