Skip to main content

Bug Tracker

Side navigation

#14530 closed bug (notabug)

Opened November 11, 2013 01:38AM UTC

Closed December 30, 2013 05:09PM UTC

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

Reported by: jRubinator@gmail.com Owned by:
Priority: undecided Milestone: None
Component: unfiled Version: 1.10.2
Keywords: Cc:
Blocked by: Blocking:
Description

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)

Attachments (0)
Change History (2)

Changed December 08, 2013 03:43PM UTC by dmethvin comment:1

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.

Changed December 30, 2013 05:09PM UTC by dmethvin comment:2

resolution: → notabug
status: newclosed

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