Coder Social home page Coder Social logo

Comments (12)

GoogleCodeExporter avatar GoogleCodeExporter commented on July 28, 2024
I don't really like $/$$. I only added them for the slickspeed test - it 
occurred to
me that there was no single function we could provide for the test. I still 
think it
is a good idea to have global functions for DOM queries, otherwise you have to 
do this:

var match = base2.DOM.Document.matchSingle(document, "#id-selector");

versus:

var match = base2.$("#id-selector");

Maybe we can keep $/$$ but just not export those symbols?

Original comment by [email protected] on 16 Jul 2007 at 9:52

from base2.

GoogleCodeExporter avatar GoogleCodeExporter commented on July 28, 2024
Ahem, $ is defined in DOM, isn't it?

Anyways, my "analysis"

1) matchSingle("#id")
2) base2.$("#id")
3) DOM.$("#id")
4) DOM$("#id")
5) dom$("#id")
6) css$("#id")

and

1) matchAll("input[@type='text']")
2) base2.$$("input[@type='text']")
3) DOM.$$("input[@type='text']")
4) DOM$$("input[@type='text']")
5) dom$$("input[@type='text']")
6) css$$("input[@type='text']")

Explanation:
1) matchAll just, hmm, isn't it
2) this confuses people, if you didn't make a mistake (use base2.$, but import 
DOM)
3) this is already getting better
4) but it's a function, why just not let it be imported
5) and since functions are in thisCase, is should be lower case
6) because DOM is more than CSS, and css$ is a bit more recognizable for what 
it does, I favour this option.

Original comment by [email protected] on 17 Jul 2007 at 12:12

from base2.

GoogleCodeExporter avatar GoogleCodeExporter commented on July 28, 2024
A bit to quick:

7) $css("#id")
7) $$css("input[@type='text']")

This will respect the community de-facto standard, of using the $-prefix for 
shortcuts.

Original comment by [email protected] on 17 Jul 2007 at 12:17

from base2.

GoogleCodeExporter avatar GoogleCodeExporter commented on July 28, 2024
1) matchAll just, hmm, isn't it

Currently it is selectElement/selectAllElements which, amazingly, is worse.

http://dev.w3.org/cvsweb/~checkout~/2006/webapi/selectors-api/Overview.html

2) base2.$

I quite like it now. :-(

3) DOM.$

This might be the compromise. :-)

5 - 7) I hate the other suggestions.

What about my suggestion. Include base2.$ and base2.$$ but don't add them to
base2.namespace. That way there will be no global pollution.

Original comment by [email protected] on 17 Jul 2007 at 9:23

from base2.

GoogleCodeExporter avatar GoogleCodeExporter commented on July 28, 2024
Hmm, I still like the $css. It's short, and we can use the $-prefix for our 
top-7 shortcuts:
- $attach   -> addEventListener
- $style     -> getComputedStyle
- ...

But base2.$ is alright too. PR-technical is also sound ;-)
But it might give the impression it's part of base2, and not DOM...

Original comment by [email protected] on 17 Jul 2007 at 9:41

from base2.

GoogleCodeExporter avatar GoogleCodeExporter commented on July 28, 2024
I want to add one more argument to the discussion; I still don't have a strong 
opinion about the topic, though.

What user and user groups are we catering for? OK, we implement standards. But 
we also do a bit more. The 
JSB system is pretty cool, but has some entry level barrier. We can help people 
to overcome the barriers to use 
base2, by providing some shortcut methods (but it's of course not the only 
barrier leveling method). And are 
you certain, JSB can cater 100% of all cases? If not, document.getElementById 
will be the common denominator 
in which people think. 

Also, shortcuts are handy to "just get it working first, make it nice later". 
We could benefit from a convention 
for shortcuts. This still will be possible with base2.$ (base2.$attack, ehm, I 
mean base2.$attach for example).

We also can of course define a seperate namespace "shortcuts" to add more 
shortcuts to the base2 namespace 
object... This has as advantage, we can postpone the decision (I still can't 
think of much more examples for 
the shortcuts I listed above).

...just some thoughts...

Original comment by [email protected] on 18 Jul 2007 at 4:06

from base2.

GoogleCodeExporter avatar GoogleCodeExporter commented on July 28, 2024
Oh yeah, _if_ we create a shortcut namespace, we obviously call it "b2" ;-)

Original comment by [email protected] on 18 Jul 2007 at 4:08

from base2.

GoogleCodeExporter avatar GoogleCodeExporter commented on July 28, 2024
As stated in issue 31, I think base2.$ should return DOM-bind augmented 
elements.

Original comment by [email protected] on 21 Jul 2007 at 8:43

from base2.

GoogleCodeExporter avatar GoogleCodeExporter commented on July 28, 2024
I've moved the $ methods to base2.DOM. I'm not sure that the $ methods should 
also bind.

> What user and user groups are we catering for?

base2.DOM implements W3C standards. The target audience is people who want to 
use
standards.

> OK, we implement standards. But we also do a bit more.

Not in this library. Maybe in JSB or another library. This package should only 
do one
job - implement W3C DOM APIs. We can always build something cool on top of 
base2.DOM..

I'm keeping this bug open until we make up our minds. :-)

Original comment by [email protected] on 23 Jul 2007 at 8:56

from base2.

GoogleCodeExporter avatar GoogleCodeExporter commented on July 28, 2024
> > OK, we implement standards. But we also do a bit more.
> Not in this library.

With "a bit" I meant the $ function, and JSB/JST/RegGrp etc.

Another thought about shortcuts: I think this is also personal. People can have 
their own shortcuts-library. 
Maybe we should encourage that.

Another thought: you know in java the file/stream api is very layered. I think 
it's a shame no shortcuts have 
been defined in the jre itself (at least, until jdk5).

Original comment by [email protected] on 23 Jul 2007 at 9:04

from base2.

GoogleCodeExporter avatar GoogleCodeExporter commented on July 28, 2024
Longer term, I'm thinking of a base-kit package that includes base2, DOM, JSB, 
JSON
and other goodies. I'd prefer to keep the individual packages small and
self-contained, each package solving one particular problem. I still don't like 
the $
function being in base2.DOM but we'll keep it here for the time being. We 
should have
a new status for issues like this - "Stalled". :-)

Original comment by [email protected] on 23 Jul 2007 at 9:39

from base2.

GoogleCodeExporter avatar GoogleCodeExporter commented on July 28, 2024
I'm closing this bug. If we decide we don't like DOM.$ we can always raise a 
new issue.

Original comment by [email protected] on 27 Jul 2007 at 10:30

  • Changed state: Fixed

from base2.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.