Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

toggle and toggleClassName broken when used with Enumerable.each #95

Closed
wants to merge 14 commits into from
+2,575 −2,083

4 participants

@SpiffyStores

The second boolean parameter conflicts with the second numeric parameter sent by Enumerable.each.

@pdanpdan

It may happen that there is no name attribute but type attribute

if (HAS_EXTENDED_CREATE_ELEMENT_SYNTAX && (attributes.name || attributes.type)) {
  tagName = '<' + tagName;
  if (attributes.name) {
    tagName += ' name="' + attributes.name + '"';
    delete attributes.name;
  }
  if (attributes.type) {
    tagName += ' type="' + attributes.type + '"';
    delete attributes.type;
  }
  tagName += '>';
  return Element.writeAttribute(document.createElement(tagName), attributes);
}
@SpiffyStores

A second optional parameter was added to toggle and toggleClassName, specifying a boolean value to override the current status of the element. This second element breaks the use of these methods in conjunction with Enumerable.each, as each defines the iterator as a function with two parameters, the first being the element and the second being the index number of the enumeration.

The methods have been updated to check whether the second parameter is a Boolean, rather than being just defined.

@savetheclocktower
Collaborator

Can't merge this because of all the other commits, so I'm closing this as a duplicate of #136. But it will get fixed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Apr 23, 2011
  1. @SpiffyStores
  2. @SpiffyStores
Commits on Apr 26, 2011
  1. @SpiffyStores
  2. @SpiffyStores
  3. @SpiffyStores
  4. @SpiffyStores

    Update sizzle to 1.5.1-14

    SpiffyStores authored
Commits on Apr 27, 2011
  1. @SpiffyStores

    Add type attribute to the extended create syntax to allow it to be co…

    SpiffyStores authored
    …rrectly set in IE7 mode under IE8.
Commits on Apr 28, 2011
  1. @SpiffyStores
Commits on Jan 17, 2013
  1. @esb
  2. @esb
  3. @esb
  4. @esb
Commits on Jan 18, 2013
  1. @esb

    Merge changes for 1.7.1

    esb authored
Commits on Jan 23, 2013
  1. @esb

    toggle and toggleClassName broken when used with Enumerable.each beca…

    esb authored
    …use of the addition of second boolean parameter
Something went wrong with that request. Please try again.