Skip to main content

Bug Tracker

Side navigation

#13740 closed bug (duplicate)

Opened April 06, 2013 01:36AM UTC

Closed April 06, 2013 02:50AM UTC

Trying to set or retrieve "loop" attribute fails

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

Let's say I have:

<div loop="1"><div>

This is what I get trying to read or set attribute

$('div').attr('loop')

'loop'

$('div').attr('loop', 1)

[<div loop="loop"><div>]

Attachments (0)
Change History (3)

Changed April 06, 2013 01:41AM UTC by anonymous comment:1

Some more info: Tried on Chrome 26 and 28, and Firefox 20.0.

All on Windows 7 64bit

jQuery 1.9.1

Here's a quick jsFiddle: http://jsfiddle.net/CTDkJ/

Changed April 06, 2013 02:43AM UTC by m_gol comment:2

That's because loop is treated as a boolean attribute because it's used as such in HTMLMediaElement:

https://developer.mozilla.org/en-US/docs/DOM/HTMLMediaElement

The element constructor is not checked in jQuery when matching the attribute name against predefined boolean ones; changing this method would increase jQuery size and there are not a lot of such boolean attributes.

Anyway, if you use custom attributes without prepending them with data-, it's your responsibility to make sure those names don't conflict with built-in ones, custom attributes are required to be prepended by data- per HTML5 spec.

Changed April 06, 2013 02:50AM UTC by m_gol comment:3

resolution: → duplicate
status: newclosed

Duplicate of #12095.