Bug Tracker

Opened 9 years ago

Closed 9 years ago

#14530 closed bug (notabug)

elem.text("text") does not work for textNodes

Reported by: [email protected] Owned by:
Priority: undecided Milestone: None
Component: unfiled Version: 1.10.2
Keywords: Cc:
Blocked by: Blocking:


jQuery's mutator method for textNode.text() does not change the textContent of the textNode

See http://jsfiddle.net/4epJ6/2/ (this assumes your are not using IE, as it uses .textContent instead of .innerText to demonstrate the issue)

Change History (2)

comment:1 Changed 9 years ago by dmethvin

For most API calls, only an Element (.nodeType===1) has full standing in a jQuery collection. The docs don't imply that the .text() method works with text nodes, so this is not a bug but a feature enhancement.

I'm concerned that if we add the special-case code to do this, it will just lead to more requests to give text nodes full standing with a requisite increase in size, for very little benefit.

Perhaps someone could do a survey of the API to see where we would need to change, and determine if that concern is warranted? Lacking that I'm not in favor of adding this feature.

comment:2 Changed 9 years ago by dmethvin

Resolution: notabug
Status: newclosed

We decided this wasnt a feature we wanted to do, it confuses the use of DOM methods even more.

Note: See TracTickets for help on using tickets.