Commit Graph

200 Commits

Author SHA1 Message Date
Richard Gibson
80d45a69ea Fix #12840: remove undocumented parameter "pass" from .attr. Close gh-1017. 2012-11-05 17:21:24 -05:00
Dave Methvin
240b141a22 Fix #10299. Add a propHook for oldIE link href. 2012-11-01 20:50:45 -04:00
Richard Gibson
3f51504580 No ticket: remove test suite external dependencies 2012-11-01 17:32:08 -04:00
Timo Tijhof
36c9ecb0f5 Implement expectation test instead of using _removeData. Close gh-997.
* Removed inline usage of QUnit.reset() because it is messing with the
  expectation model as reset does .empty() which does a recursive cleanData
  on everything in #qunit-fixture, so any expectJqData above .reset() would
  fail negatively.

  Instead of calling reset inline, either updated the following assertions to
  take previous assertions' state into account, or broke the test() up into
  2 tests at the point where it would call QUnit.reset.

* After introducing the new memory leak discovery a whole bunch of tests were
  failing as they didn't clean up everything. However I didn't (yet) add
  QUnit.expectJqData calls all over the place because in most if not all of
  these cases it is valid data storage. For example in test "data()", there
  will be an internal data key for "parsedAttrs". This particular test isn't
  intending to test for memory leaks, so therefor I made the new discovery
  system only push failures when the test contains at least 1 call to
  QUnit.expectJqData.

  When not, we'll assume that whatever data is being stored is acceptable
  because the relevant elements still exist in the DOM anyway (QUnit.reset
  will remove the elements and clean up the data automatically).

  I did add a "Always check jQuery.data" mode in the test suite that will
  trigger it everywhere. Maybe one day we'll include a call to everywhere,
  but for now I'm keeping the status quo: Only consider data left in storage
  to be a problem if the test says so ("opt-in").

* Had to move #fx-tests inside the fixture because ".remove()" test would
  otherwise remove stuff permanently and cause random other tests to fail
  as "#hide div" would yield an empty collection.
  (Why wasn't this in the fixture in the first place?)

  As a result moving fx-tests into the fixture a whole bunch of tests failed
  that relied on arbitrary stuff about the document-wide or fixture-wide
  state (e.g. number of divs etc.). So I had to adjust various tests to
  limit their sample data to not be so variable and unlimited...

* Moved out tests for expando cleanup into a separate test.

* Fixed implied global variable 'pass' in effects.js that was causing
  "TypeError: boolean is not a function" in *UNRELATED* dimensions.js that
  uses a global variable "pass = function () {};" ...

* Removed spurious calls to _removeData. The new test exposed various failures
  e.g. where div[0] isn't being assigned any data anyway.
  (queue.js and attributes.js toggleClass).

* Removed spurious clean up at the bottom of test() functions that are
  already covered by the teardown (calling QUnit.reset or removeClass to
  supposedly undo any changes).

* Documented the parentheses-less magic line in toggleClass. It appeared that
  it would always keep the current class name if there was any (since the
  assignment started with "this.className || ...".

  Adding parentheses + spacing is 8 bytes (though only 1 in gzip apparently).
  Only added the comment for now, though I prefer clarity with logical
  operators, I'd rather not face the yayMinPD[1] in this test-related commit.

* Updated QUnit urlConfig to the new format (raw string is deprecated).

* Clean up odd htmlentities in test titles, QUnit escapes this.
  (^\s+test\(.*)(&gt\;) → $1>
  (^\s+test\(.*)(&lt\;) → $1<

[1] jQuery MinJsGz Release Police Department (do the same, download less)
2012-10-28 22:44:57 -04:00
Matthias Jäggli
227c49a459 Fix #12411, .removeClass(undefined) is a chaining no-op. Close gh-913.
.removeClass() //removes all classes, as documented
.removeClass(window.nonExistentVariable) // removes nothing
2012-10-21 21:06:41 -04:00
Sai Wong
2b0e720406 Fix #12048. Set attributes for XML fragments. Close gh-965. 2012-10-20 15:27:43 -04:00
Jonathan Sampson
144b8bfead Fix attribute names in aliased form property test. Close gh-951.
Test expects input elements having name='id', name='name', and name='target'. Additionally, these should have id='id', id='name', and id='target' respectively. No element was provided with id='id' or name='id', but rather one element had two name attributes (illegal) with the values 'id' and 'name' respectively.
2012-10-20 14:58:19 -04:00
Rick Waldron
fd5facf1d1 Convert all jQuery.removeData(foo, bar, true) calls to jQuery._remove(foo, bar)
Signed-off-by: Rick Waldron <waldron.rick@gmail.com>
2012-10-16 14:14:37 -04:00
Erick Ruiz de Chavez
69ce829dfe Enforce style guide in test/unit/attributes.js. Closes gh-985 2012-10-16 12:29:21 -04:00
Mike Sherov
ed9e34482a enforce double quotes via JSHint. Closes gh-975 2012-10-16 10:17:14 -04:00
Richard Gibson
425d17de83 Fix #12583: Don't ignore disabled property of select-one, close gh-932. 2012-10-03 21:14:08 -04:00
Dave Methvin
631fbc769c Since .getAttribute() returns strings, we should check for them. 2012-09-30 22:19:31 -04:00
Mike Sherov
f9ef91d6d6 Fix #10943, tabindex not set properly on clone in IE7. Close gh-937.
This is only a unit test fix because the bug was tangentially fixed by a different commit
2012-09-30 20:40:45 -04:00
Dave Methvin
f4e5c1729a Fix #11547. toLowerCase not work good on XML attributes.
This was fixed to some extent in gh-724 but there were insufficient test cases. Removing the lowercase completely allows IE 6/7 to work properly since there you need an exact case match for attributes, even in HTML docs. More discussion and test cases in the comments on gh-724.
2012-07-11 23:09:07 -04:00
Chad Killingsworth
de9bed319e Make unit tests friendly to Closure Compiler. Closes gh-845.
Conflicts:
    	test/unit/effects.js
    	test/unit/offset.js
2012-07-05 15:52:42 -04:00
Rick Waldron
3206be8772 Make removeClass smart enough to remove duplicates. Fixes #11923 2012-06-23 19:38:27 -04:00
Rick Waldron
7ff3da186c Unit tests are linted and passing. 2012-06-21 15:30:24 -04:00
jaubourg
ac48a19b92 Some work to modularize ajax later on. 2012-06-11 14:00:16 +02:00
Mike Sherov
5f35b3d9f9 Fix #11857. Modularize css.js, add dependency management. Closes gh-816.
See the pull request for more info on the dependency management details.
2012-06-10 21:54:16 -04:00
Mike Sherov
c68ab270fa Modularize offset (exclude w/ grunt build:*:*:-offset). Closes #813. Fixes #11865 2012-06-07 11:24:35 -04:00
Rick Waldron
e680f36ca0 Fix busted tests that relied on width in 2nd param to jQuery(), dimensions stays modular. (core, attributes, offset)
Signed-off-by: Rick Waldron <waldron.rick@gmail.com>
2012-06-05 16:38:18 -04:00
timmywil
1122c8ce32 Adjust the return type for the tabindex attribute tests to be a string. Recomment a tabindex test since FF12's QSA includes video elements that don't have a tabindex attribute.
Related:
https://bugzilla.mozilla.org/show_bug.cgi?id=618737
2012-05-30 15:00:30 -04:00
timmywil
3e2a77c5e8 Remove the tabindex attrHook. Fixes #8473 2012-05-30 13:46:50 -04:00
timmywil
a8d9d05388 Add quick-start documentation for testing with QUnit and using jQuery's helper methods. 2012-05-29 13:13:26 -04:00
Yehuda Katz
16249f0acd Fix some stragglers 2012-04-15 17:52:48 -04:00
Yehuda Katz
6bc08c2b2f Remove Ajax requirement for simple XML tests
Previously, all jQuery tests that wanted an XML
document would make an Ajax request to go through
jQuery's XML parsing logic in jQuery.ajax. Now,
use jQuery.parseXML instead.

This removes the need for the Ajax server for
these tests, improves their performance, and
decouples simple core tests from Ajax.

(with scottgonzalez)
2012-04-15 17:41:54 -04:00
Arne de Bree
0e2642d216 Fix 11547. XML and IE DOM can't be force-lowercase in removeAttr().
See discussion on pull request: https://github.com/jquery/jquery/pull/724
2012-04-10 18:25:04 -04:00
timmywil
d3320462df Do not set boolean attributes to empty string on removal. Fixes #10870. +0 bytes compressed 2012-03-05 12:54:44 -05:00
Mike Sherov
da02e190b5 Fixes #10828, .attr("coords") returns undefined in IE7 2012-03-02 11:08:52 -05:00
Richard Gibson
6c2a501de4 Fix #5571. Setters should treat undefined as a no-op and be chainable. 2011-12-06 15:25:38 -05:00
Rick Waldron
a8460d24e0 Landing pull request 600. Remove jQuery.trim() to restore perf. Supplements #10773.
More Details:
 - https://github.com/jquery/jquery/pull/600
 - http://bugs.jquery.com/ticket/10773
2011-11-14 12:24:58 -05:00
Oleg
a467aa0a77 Fix #10773. Improve parameter handling in removeAttr. 2011-11-14 11:30:53 -05:00
Mike Sherov
f35ba5e699 Fix #10691. Remove all instances of equals() and same(), as these are deprecated in QUnit. 2011-11-06 15:27:42 -05:00
timmywil
c51b29477e Support setting both the enctype attribute and property (encoding in IE6/7). Fixes #6743. 2011-10-22 16:03:57 -04:00
timmywil
f2c1d2e016 Use the property name in elem.removeAttribute in IE6/7 to ensure correct removals. Fixes #10514. 2011-10-17 16:45:37 -04:00
timmywil
ce8d9c0ca5 Add a hook for removing contenteditable in IE6/7 and remove the unnecessary jQuery.attrFix. Fixes #10429. 2011-10-06 17:17:51 -04:00
Rick Waldron
ca4133cc3f Landing pull request 492. 1.7 Remove multiple attributes (Symmetry with removeClass) Combines patches submitted by leeoniya, zertosh and my own tests. Fixes #5479.
More Details:
 - https://github.com/jquery/jquery/pull/492
 - http://bugs.jquery.com/ticket/5479
2011-09-19 21:07:07 -04:00
timmywil
29c52b0f6c Add sparse array performance improvement for inArray. Thanks rwaldron, rkatic, and jdalton 2011-09-19 15:42:32 -04:00
timmywil
daeb665045 Check for property support in the boolHook before falling back to attribute node. Fixes #10278. 2011-09-19 15:42:32 -04:00
timmywil
92405d4f5f Override Sizzle attribute retrieval with jQuery.attr. Fixes #5637, #7128, #9261, #9570, #10178.
Bug fixed on the side: $(window).is('a') was throwing an exception. Fixes #10178.
2011-09-19 15:42:30 -04:00
timmywil
d723942b27 Revert back to always setting the attribute to empty string before removal. Fixes #9699. 2011-08-25 15:33:54 -04:00
Rick Waldron
13647e94e0 Fixes assertion counts and dom element fixture issue 2011-08-05 10:02:33 -04:00
timmywil
8c2cb49917 Now using getAttributeNode in all attribute cases in IE6/7, which normalizes attribute behaviors across browsers, is less hacky, and shortens the attribute code. Fixes #9980. 2011-08-04 18:16:15 -04:00
timmywil
fd4ee2a397 Make the tabIndex hook first a propHook and add it to attrHooks for back-compat reasons. Fixes #9979. 2011-08-04 18:16:15 -04:00
Dave Methvin
6a3395afcd Merge pull request #419 from rwldrn/9630
Unit tests assert that .contents().hasClass() works as expected. Fixes #9630
2011-08-04 14:33:52 -07:00
timmywil
1886d74434 Check the attribute node value for false for HTML5 booleans when not supported. Fixes #9504. 2011-07-09 14:52:16 -04:00
rwldrn
bb1702518e Filter hasClass by nodeType 1; Fixes #9630 2011-06-22 08:50:44 -04:00
rwldrn
27e5052a7b Assert that .contents().hasClass() works as expected. Fixes #9630 2011-06-21 14:04:06 -04:00
timmywil
96501d38a9 Allow similarly named classes (regression from 9499) and switch class retrieval to property when passing class to value functions. Fixes #9617. 2011-06-19 18:58:47 -04:00
timmywil
641ad80211 Attribute hooks do not need to be attached in XML docs. Fixes #9568. 2011-06-13 10:02:13 -04:00
timmywil
db437be6e3 Check classes passed for duplicates. Fixes #9499. 2011-06-07 21:00:44 -04:00
rwldrn
f82b9dddc4 Landing pull request 382. Adds support for number values (meter,progress); Fixes #9319.
More Details:
 - https://github.com/jquery/jquery/pull/382
 - http://bugs.jquery.com/ticket/9319
2011-05-20 11:03:33 -04:00
timmywil
25118e22a2 Handle unset value attributes consistently depending on property existence. Supplements #9328. 2011-05-18 11:46:22 -04:00
timmywil
ba90af0dc5 Make the value hook less obtrusive for elements which do not inherently have a value property. Fixes #9328. 2011-05-18 11:29:25 -04:00
timmywil
7d3ba9f89e Switched title attribute to getAttributeNode for IE6/7. Fixes #9329. 2011-05-18 11:05:20 -04:00
timmywil
a5cf257a8a Use getAttributeNode for ^on attributes in IE6/7 to avoid anonymous function wrapper. Fixes #9298. 2011-05-16 10:17:50 -04:00
timmywil
6171e0a923 Retrieve the class attribute on a form in IE6/7. Fixes 9286. 2011-05-14 12:07:40 -04:00
timmywil
bc82ff0ff9 Make sure setting boolean attributes to the same name sets the property to a boolean type 2011-05-13 13:39:38 -04:00
timmywil
6f676e692d Use prop to retrieve boolean properties (so the selected hook will be used) 2011-05-13 13:33:43 -04:00
timmywil
4526c8b0a0 Add fallback to prop for the window and document. Switch value to use the property instead of the attribute for back compat. 2011-05-10 00:28:02 -04:00
timmywil
18b1cf2942 Remove value check from formHook; other elements can use value hook 2011-05-07 22:01:10 -04:00
timmywil
8bb6e95b66 Set val before hide/show check and fix easing setting; also update attributes test for autofocus
- The object passed should not change so it can be used in future animates, updated src and tests accordingly.
2011-05-07 20:46:38 -04:00
timmywil
c085563270 Reduce the boolean list only to those that have corresponding IDLs that don't require being added to propFix; only set the IDL if it exists
- See http://jsfiddle.net/timmywil/u5NLn/ for how boolean attributes are handled in every browser.
2011-05-07 14:49:04 -04:00
timmywil
c72b0f3256 Check empty string instead of specified as specified is inconsistent on the name attribute. Fixes #9148. 2011-05-06 13:49:20 -04:00
timmywil
cccf9ad91d Add support for the contenteditable attribute 2011-05-05 12:52:04 -04:00
timmywil
5195335cf4 Set the property corresponding to a boolean attribute when setting to true. Fixes #9103.
- Once boolean properties had been modified natively, setting the attribute no longer set the current value
2011-05-04 15:53:00 -04:00
timmywil
480b88ca37 Set corresponding property to false when removing boolean attributes. Fixes #9094 2011-05-04 11:29:38 -04:00
timmywil
97144424cc Update boolean check to avoid crashes, add all name fixes to propFix (properties are case-sensitive in all browsers), add tests for prop 2011-05-04 00:31:01 -04:00
John Resig
a9d9f8c542 If no hook is provided, and a boolean property exists, use that to return an attribute-style value for boolean attributes. Fixes #9079. 2011-05-03 21:44:42 -04:00
timmywil
4ac2fdda2c Fix setting value attributes on option elements. Fixes #9071. 2011-05-03 14:48:36 -04:00
timmywil
24a8ffb3ea Test for a colon in attribute names for IE6/7. Fixes #1591. 2011-05-01 17:09:50 -04:00
timmywil
5165033883 Add tests data- and aria- attributes and the autofocus boolean attribute and some style updates in jQuery.attr 2011-04-25 12:41:12 -04:00
timmywil
3ac9eb7ce3 Landing pull request [337](https://github.com/jquery/jquery/pull/337). Value of radio inputs resets when type is set after the value in all IEs. Fixes #8570 ([bug](http://bugs.jquery.com/ticket/8570)). 2011-04-21 21:33:09 -04:00
timmywil
825d3d96ce Only use getAttributeNode on buttons when setting value 2011-04-19 13:17:38 -04:00
timmywil
34d80709ce Fix value attribute and val for value on button elements. Fixes #1954 2011-04-17 18:17:31 -04:00
timmywil
ecf6a3c383 Switch QUnit div from depreceted #main to #qunit-fixture 2011-04-17 02:43:57 -04:00
timmywil
b6d21592cb Add support for setting the cellPadding attribute in IE6/7 2011-04-14 23:11:49 -04:00
timmywil
ca5bc202ac IE9's support for SVG elements unfortunately does not extend to clearAttributes. Checks for its presence before proceeding. 2011-04-13 23:45:58 -04:00
timmywil
69866fd2e5 VML.type test was causing multiple test suite fails, fix attributes.js fail in IE6 where the val(String/Number) tests were interfering with the val(Function) tests 2011-04-12 19:32:18 -04:00
louisremi
11adde5127 second batch 2011-04-11 22:33:29 +02:00
timmywil
da89d8768c Had some stale code in test/unit/attributes.js 2011-04-10 15:40:49 -04:00
timmywil
3a1b4661f5 #8150 - When removing the width and height attributes in IE6/7, setting to "" actually sets to 0 instead of auto
- Having fixed this automatically with the use of removeAttribute in browsers that support it, this will fix it for IE6/7 as well.

- This has no effect on width/height styles set elsewhere( test added to removeAttr )

- With this addition, I need to call attr in removeAttr for IE6/7, which means boolean calls like .attr("checked", "") will no longer remove the attribute, which I think is fine.  .attr("checked", false) will still remove.  If I had left it, it would have gone in an infinite loop since setting to empty string is the only way to remove it in these browsers.

- The hrefNormalized hooks were returning null if they weren't present.  Added the null check to the getter.

- Now that the style support fails in IE8 as well due to uppercasing everything, no need to have style included with the hrefNormalized hooks
2011-04-09 17:25:06 -04:00
timmywil
17afd80d48 IE8 testing for lowercasing the css properties on retrieving style; had assumed the style support check failed in IE8, which it now does 2011-04-09 15:56:35 -04:00
timmywil
6f79bee3e3 Normalize css property names to lowercase for comparisons on a .attr('style') call since IE uppercases everything 2011-04-03 19:13:41 -04:00
timmywil
ad2b3bc9f9 Found a problem removing the style attribute in IE
- Style is now a special case in IE6/7 to set cssText.  My goal is to avoid calling attr again for the performance benefit, and at this point it would also cause an infinite loop for the boolean attributes hooks such as selected & checked.  Nevertheless, style seems to be the only one requiring a special call.
2011-04-03 19:13:41 -04:00
timmywil
8cbf551a48 #5413 - Much shorter solution for getting width/height in ie6
- #8255 Added support for the list attribute in browsers that support it (it is automatically readonly, but can be set if using getAttribute( name, 2)
2011-04-03 19:13:41 -04:00
timmywil
5fc2281fcc - Added a hook to swap display none for width and height in browsers that do not sufficiently support get/setAttribute 2011-04-03 19:13:41 -04:00
timmywil
fa4373c11b Add style attribute support tests to $.attr 2011-04-03 19:13:41 -04:00
timmywil
e0900a686d Fix issue where non-existant attributes on forms in IE6/7 were throwing errors 2011-04-03 19:13:40 -04:00
timmywil
3892df207d Add test for bug #3116 2011-04-03 19:13:40 -04:00
timmywil
47c80c2050 Add test for bug#3685, remove added html and add dynamicly to avoid global test suite errors 2011-04-03 19:13:40 -04:00
timmywil
9e05a0a37f Fix #6562, tighten up the special code for form objects, add name attrHook for IE6/7, and don't check for undefined with getting hook'd attr 2011-04-03 19:13:40 -04:00
timmywil
102053abd8 Fix #7472 and added test for #3113
- Forms with an input that has either name="action" or name="some-other-attr-on-the-form" caused problems in IE6/7.  This is fixed.

- Changed check in $.attr for ret === null to typeof ret === "object" to catch any inputs that are accidentally retrieved in IE6/7, since attributes cannot be set to objects and typeof null === "object"
2011-04-03 19:13:39 -04:00
timmywil
2580420b7e Test description 2011-04-03 19:13:39 -04:00
timmywil
5ac6ca3fa5 Restored 6 tests that I had commented to come back to later to split up between prop and attr. All tests still pass in all browsers.
- I should make it clear that I have not removed any tests, but only moved some attr tests to prop where I thought it was appropriate.
2011-04-03 19:13:39 -04:00
timmywil
dbe3b7a9d0 Style edits according to comments from John and rwaldron. 2011-04-03 19:13:39 -04:00
timmywil
8cd30c62d8 Continuing IE7 testing, conditional attr fixes and hooks with feature testing. Will figure out a way to shorten after the test suite passes. 2011-04-03 19:13:39 -04:00
timmywil
5eecb13fa3 Now passes in IE8, changed around $.hasAttr and switched the attrHook for selected to be a propHook 2011-04-03 19:13:38 -04:00
timmywil
de79e8c7e0 Make the new attr/prop changes pass the test suite (in Webkit). There are still errors in IE.
+ Added hooks for selected, checked, readonly, disabled to removeAttr if set to falsey

+ Removed all attrs from attrFix, these aren't needed for setAttribute

+ If prop is used for class, do we want a propFix for class?

  - We could just assume the user should know to use className with prop.  I've done the latter for now.

+ Created tests for $.fn.prop and $.fn.removeProp

  - Actually all I did was change broken attr tests to prop where it made sense.
2011-04-03 19:13:38 -04:00
rwldrn
43a41ba7ec Make sure .val() works after form.reset() in IE. Fixes #2551. 2011-02-10 23:50:02 +01:00