Opened 12 years ago

Closed 11 years ago

Last modified 11 years ago

#4205 closed defect (fixed)

add sugar to dojo.NodeList

Reported by: alex Owned by: alex
Priority: high Milestone: 1.1
Component: Core Version: 0.9
Keywords: Cc: nathan,
Blocked By: Blocking:

Description

as discussed in this week's IRC meeting, add syntactic sugar to dojo.NodeList? to make event connection, style setting, and iteration easier. Should land for 0.9.

Attachments (1)

html.patch (739 bytes) - added by nathan 11 years ago.
A patch which will revert to the previous behavior. This is NOT probably the desired solution, but for any who are having problems with form submission, this may be an interim fix.

Download all attachments as: .zip

Change History (19)

comment:1 Changed 12 years ago by alex

(In [10267]) start of checkins for syntatic sugar for dojo.NodeList?. This doesn't directly add sugar, but other methods will want/need dojo.connectPublisher(). Refs #4205

comment:2 Changed 12 years ago by alex

(In [10268]) start of some syntatic sugar for NodeLists?. Makes connecting to common events easier as well as changing css class names on a list. Refs #4205.

comment:3 Changed 12 years ago by alex

(In [10269]) allow dojo.forEach(), dojo.map(), and related functions to take strings as functions to execute. Need to investigate caching the resulting anonymous functions. Makes operating on NodeLists? much easier. Refs #4205

comment:4 Changed 12 years ago by tk

Are there any more changes for this, or was a "fixes" forgot in the checkin message?

-Karl

comment:5 Changed 12 years ago by alex

Status: newassigned

still need to add methods:

  • attr
  • removeAttr
  • html (getContent?) setter/getter

comment:6 Changed 12 years ago by alex

also consider parents() and siblings() and not()

comment:7 Changed 12 years ago by alex

(In [11146]) making the constructor smaller ('cause we can), adding slice/splice, and moving animations out to dojo.NodeList?-ext. Refs #4480. Refs #4205. Fixes #4822

comment:8 Changed 12 years ago by alex

(In [11147]) tests for slice/splice. Splice isn't working correctly on IE 6 yet (still digging). Refs #4822. Refs #4205

comment:9 Changed 11 years ago by alex

(In [12596]) adding NodeList?.onfocus(). Refs #4205. !strict

comment:10 Changed 11 years ago by alex

(In [12818]) shorten NodeList? code, add toggleClass(), and update documentation. Refs #4205. Refs #3961. !strict

comment:11 Changed 11 years ago by alex

(In [12899]) adding sugar to dojo.attr(), and therefore to it's mapping into dojo.NodeList?. Expanding tests and docs. Supports a property-bag style for attrs the same way we do with dojo.style(). Refs #4205. !strict

comment:12 Changed 11 years ago by alex

(In [12900]) ugg. Fingered the wrong test file when checking in [12899]. Refs #4205. !strict

comment:13 Changed 11 years ago by alex

Resolution: fixed
Status: assignedclosed

NodeList? is pretty sugary at this point. The only other major thing to land are Neil's behavior patches, but those are filed under separate cover.

comment:14 Changed 11 years ago by nathan

Cc: nathan added
Resolution: fixed
Status: closedreopened

OK - I don't know if reopening is the correct thing to do or not...but the changes in changelog [12899] breaks validation of dijit.form.Form.

For a test case, you can go to http://download.dojotoolkit.org/current-dev/dojo-release-1.1.0rc1/dijit/tests/form/Form.html and fill out an invalid date, and click on Submit. The validation will fail (it will tell you that the form is invalid) - but the form will submit anyway. There is no way to prevent the original form element from submitting.

If you change the dojo.connect on line 1092 to a node[name] = value, then everything is happy and it works as expected - that's roughly the way it used to work.

Can anyone shed any light on the reasoning behind that change?

Changed 11 years ago by nathan

Attachment: html.patch added

A patch which will revert to the previous behavior. This is NOT probably the desired solution, but for any who are having problems with form submission, this may be an interim fix.

comment:15 Changed 11 years ago by nathan

It seems like the issue is calling the function via a dojo.connect - which makes it impossible to return false from the connected function to cancel the actual submit from happening. It seems that this would happen as well for other functions attached to html elements (onClick, onKeypress, etc).

comment:16 Changed 11 years ago by bill

Priority: normalhigh

comment:17 Changed 11 years ago by alex

Resolution: fixed
Status: reopenedclosed

don't return false, dojo.stopEvent() on the passed event object.

Not a bug.

comment:18 Changed 11 years ago by bill

See #6299; we refactored Form to not use dojo.attr() and reinstated the ability to use "return false" as a way to cancel the form submit.

Note: See TracTickets for help on using tickets.