lewisje / ourlibrary

Automatically exported from code.google.com/p/ourlibrary
0 stars 0 forks source link

some DOM methods fail with deferAudio = true #6

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. grab a build of mylib.js and include it in a page
2. add `<script>API = { deferAudio = true };</script>`
3. try to use getEBI or getEBTN or ...

What is the expected output? What do you see instead?
I expect the method to return the appropriate element. Instead I get 
"TypeError: Result of 
expression 'API.getEBTN' [undefined] is not a function." (could be getEBI, 
getAttribute etc.). 
Comment out the line that sets deferAudio to true and everything works as 
expected.

What version of the product are you using? On what operating system?
Sun, 28 Mar 2010 22:49:28 UTC

Please provide any additional information below.
attached is a simplified test case.

Original issue reported on code.google.com by johnm...@gmail.com on 28 Mar 2010 at 11:45

Attachments:

GoogleCodeExporter commented 9 years ago
Actually it seems much more can go wrong when you set deferAudio to true. For 
example, in a "lightbox" 
page I'm working on I have the code:

E('container').on('click', function (click) {
  if (API.hasClass(API.getEventTarget(click), 'lightbox')) {
    return API.cancelDefault(click);
  }
});

which works great...until I set deferAudio to true. After which the click 
events are no longer cancelled.

Original comment by johnm...@gmail.com on 29 Mar 2010 at 1:59

GoogleCodeExporter commented 9 years ago
You've got the order wrong.

<script type="text/javascript">
API = { deferAudio: true };
</script>
<script type="text/javascript" src="mylib.js"></script>

The other way around will overwrite API.  :)

Original comment by dmark.ci...@gmail.com on 29 Mar 2010 at 2:44