Bug Tracker

Modify

Ticket #11387 (closed bug: invalid)

Opened 2 years ago

Last modified 2 years ago

JQuery creates "placeholder" attribute on every input element

Reported by: ontwerpen@… Owned by:
Priority: low Milestone: None
Component: attributes Version: 1.7.1
Keywords: Cc:
Blocking: Blocked by:

Description

Somehow JQuery silently creates an empty "placeholder" attribute on every input element. Try it out on the JQuery homepage with

$("input:first").attr("placeholder")

or native

document.querySelector("input").placeholder

Both will give "" as a result, while really they should be undefined (compare with a page with an input and no JQuery).

This needs to be fixed because in the current situation, it is impossible to detect whether an *empty* placeholder attribute is present or *no* placeholder attribute is present. This can hinder development of plugins that show custom placeholders.

Change History

comment:1 Changed 2 years ago by sindresorhus

  • Priority changed from undecided to low
  • Resolution set to invalid
  • Status changed from new to closed
  • Component changed from unfiled to attributes

 jQuery does return undefined. You can't use the frontpage as a test, since it's using an older jQ version.

Please follow the  bug reporting guidlines and use  jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.

View

Add a comment

Modify Ticket

Action
as closed
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.