Xavier MONTILLET wrote:
> Xavier MONTILLET wrote:
>> Here is the code on Github:
>> https://github.com/xavierm02/XJSAccessors/blob/master/XJSAccessors.js
> And here is a usecase:
> https://github.com/xavierm02/XJSAccessors/blob/master/XJSSelection.js

Maybe I'm simply missing the point, but I'm not convinced.  It seems
to me that you are using XJSAccessors in order to help build this API
for XJSSelection:

    Chrome:
    =======
    var x = new XJSSelection();
    x.get('selection');             // DOMSelection {...}
    x.get('range', 0);              // XJSRange {...}
    x.get('range', 0).get('range'); // Range {...}
    x.get('rangeCount');            // 1

    FF:
    ===
    var x = new XJSSelection();
    x.get('selection');   // Selection {...}
    x.get('range', 0);    // Error (no support for rangeCount)
    x.get('rangeCount');  // Error (no support for rangeCount)

But that API seems much more complicated than this:

    Chrome:
    =======
    var x = new XJSSelection();
    x.getSelection();             // DOMSelection {...}
    x.getRange(0);                // Range {...}
    x.getRangeCount();            // 1

    FF:
    ===
    var x = new XJSSelection();
    x.getSelection();   // Selection {...}
    x.getRange(0);      // Error (no support for rangeCount)
    x.getRangeCount();  // Error (no support for rangeCount)

And the code that uses these accessors is more complicated than the
code that doesn't use them, at least in my simple-minded test:

    Original: http://scott.sauyet.com/Javascript/Test/2011-08-30a/
    Reworked: http://scott.sauyet.com/Javascript/Test/2011-08-30c/

In either of these, you can load the page, select a range, and enter
`test()` in the console.

The reworked version seems to provide the same facilities without
exposing any unwanted implementation details, using shorter, cleaner
code.  That's why I haven't yet seen the benefits of your accessors.
What am I missing?

  -- Scott


-- 
To view archived discussions from the original JSMentors Mailman list: 
http://www.mail-archive.com/[email protected]/

To search via a non-Google archive, visit here: 
http://www.mail-archive.com/[email protected]/

To unsubscribe from this group, send email to
[email protected]

Reply via email to