ricardos4n / base2

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

Elements not DOM.bound when namespace are not imported #31

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
When using DOM.DocumentSelector, the returned element(s) are not bound to the 
HTMLElement-
Module.

I expect the following line to work:
  base2.DOM.DocumentSelector.matchSingle(document,'p').addClass('test');

but that results in ...addClass is not a function. This works, though:
  eval(base2.namespace);
  eval(base2.DOM.namespace);
  base2.DOM.DocumentSelector.matchSingle(document,'p').addClass('test');

But: only in Firefox. Safari and WebKit still think addClass isn't a method, 
though.

See also attached test-case.

Original issue reported on code.google.com by doek...@gmail.com on 21 Jul 2007 at 6:31

Attachments:

GoogleCodeExporter commented 8 years ago
This is expected behaviour. The module methods return unbound elements. I wrote 
it
this way deliberately. See my blog posts about base2.DOM. There has to be a way 
to
retrieve elements without extending them. That's why we have optional binding. 
Do you
think we should change this? I think it's a good feature.

Original comment by dean.edw...@gmail.com on 21 Jul 2007 at 7:30

GoogleCodeExporter commented 8 years ago
OK, I think I understand now. I didn't get the difference between module- and 
DOM.bind-use. But now I re-read 
it, you very clearly state "there is no augmentation of elements" in your 
"other-ways" article.

To think about it, it's a good feature. Great thinking!

But I also think, the base2.$-function should return bound methods. I mean, 
it's all about shortcuts.
I'll update the $-issue for this.

Original comment by doek...@gmail.com on 21 Jul 2007 at 8:42