Opened 5 years ago

Closed 5 years ago

#18433 closed defect (fixed)

dojo/NodeList-manipulate::text() doesn't return documented result

Reported by: Michael J Van Sickle Owned by: bill
Priority: undecided Milestone: 1.11
Component: Core Version: 1.10.3
Keywords: Cc:
Blocked By: Blocking:

Description

The documentation for dojo/NodeList-manipulate::text() say says that it will return the textContent of the first node if no arguments are provided. However, the implementation concatenates the textContent of all of the nodes.

Example: http://jsbin.com/biximuwalu/1/edit?html,console,output per docs, I would expect "foo" to be written to the console, however "foobar" is written

Attachments (1)

text.html (440 bytes) - added by bill 5 years ago.
test case for text() corresponding to example in API doc

Download all attachments as: .zip

Change History (5)

comment:1 Changed 5 years ago by bill

Owner: set to Michael J Van Sickle
Status: newpending

That's not what the API doc says, see https://github.com/dojo/dojo/blob/master/NodeList-manipulate.js#L152, which says:

returns the text value for all the nodes in the NodeList? in one string.

It's also not what the reference doc says, see https://github.com/dojo/docs/blob/master/dojo/NodeList-manipulate.rst#text, which also says:

returns the text value for all the nodes in the NodeList? in one string.

What doc are you talking about?

comment:2 Changed 5 years ago by Michael J Van Sickle

Status: pendingnew

Correct, the description is correct, but the example is not. Its no sweat to correct the example, just wanted to make sure which is correct.

comment:3 Changed 5 years ago by bill

Milestone: tbd1.11
Owner: changed from Michael J Van Sickle to bill
Status: newassigned

I see. OK I'll update the example.

The doc in this Nodelist-manipulate.js could use a general cleanup, as half of it looks like it was written by E. E. Cummings, but I'll just fix the doc for that one function.

Changed 5 years ago by bill

Attachment: text.html added

test case for text() corresponding to example in API doc

comment:4 Changed 5 years ago by bill

Resolution: fixed
Status: assignedclosed
Note: See TracTickets for help on using tickets.