Commit Graph

179 Commits

Author SHA1 Message Date
aFarkas
83e9ce95d7 handle data- and aria- special 2011-04-25 12:41:12 -04:00
aFarkas
9559b1a294 dealing with boolean content attribute 2011-04-25 12:41:12 -04:00
timmywil
15ccae91db Switch the form nodeName check in attr to use jQuery.nodeName for consistency 2011-04-23 13:56:51 -04:00
timmywil
2942be780f Combine the support tests for radioValue and appendChecked 2011-04-22 00:27:52 -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
103d325887 Follow w3c standard for setting the common boolean attributes to the same name(selected, checked, readOnly, and disabled) 2011-04-19 17:48:07 -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
b6d21592cb Add support for setting the cellPadding attribute in IE6/7 2011-04-14 23:11:49 -04:00
timmywil
cb659c6054 retrieving list with getAttribute is fine, no need to add list here anymore 2011-04-11 19:30:20 -04:00
jeresig
92dfb53314 Merge branch 'attrhooks.1.6v2' of https://github.com/timmywil/jquery 2011-04-10 17:11:35 -04:00
timmywil
215c507f79 Added back support.js test for getSetAttribute and removed some duplicate code that crept into attributes.js 2011-04-10 17:08:18 -04:00
jeresig
f89edbc6e4 Merge branch 'modest_val_proposal' of https://github.com/timmywil/jquery into timmywil-modest_val_proposal
Conflicts:
	src/attributes.js
2011-04-10 16:56:56 -04:00
jeresig
b92d2f0bc9 Merge branch 'attrhooks.1.6v2' of https://github.com/timmywil/jquery into timmywil-attrhooks.1.6v2
Conflicts:
	src/attributes.js
2011-04-10 15:41:51 -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
d47c0ae422 Performance testing: localize val to each block and only set val to value when not a function 2011-04-05 22:40:12 -04:00
timmywil
94fff6ff62 Remove the unused radiocheck regex 2011-04-04 14:22:58 -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
2a8a2b6148 Move the if statement in jQuery.fn.removeAttr to jQuery.removeAttr
- Extra testing on removeAttr and IE form weirdness( all good )
2011-04-03 19:13:41 -04:00
timmywil
ff75767558 Minor adjustments and cleanup, including normalizing the value to a string when setting( list of changes below )
- Normalize set value to string to synchronize return type cross-browser

- Add style attrHook to propHooks to support style getting in all browsers for both attr and prop

- Extend the selected propHook instead of overriding a possible set function

- Remove selected propHook TODO since there is no selected content attribute and it should return null
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
1e9b3ef3d8 Move the check for the name attribute out of attr and down to the formHook definition 2011-04-03 19:13:41 -04:00
timmywil
a4d44979c6 Shorten the logic for hooks, ternary was unnecessary 2011-04-03 19:13:41 -04:00
timmywil
217a7abc43 Add name to prop hooks as well 2011-04-03 19:13:41 -04:00
timmywil
11c97bb066 Add attribute name to paramaters for hooks 2011-04-03 19:13:40 -04:00
timmywil
03da4c7ca7 Style formatting 2011-04-03 19:13:40 -04:00
timmywil
448111cbd4 No longer need to check for objects or string of null with the special form treatment and updates to removeAttr 2011-04-03 19:13:40 -04:00
timmywil
5caf7d8376 Clean up 2011-04-03 19:13:40 -04:00
timmywil
56014a1a00 Shorten even further 2011-04-03 19:13:40 -04:00
timmywil
479b28fb6a Modularize special form code for IE6/7 and clean up attr again 2011-04-03 19:13:40 -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
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
11cfdb2394 Non-existent attribute for jQuery.attr no longer needs to check for "undefined"
- Remove an unnecessary var

- Use variable in removeAttr for better minification
2011-04-03 19:13:39 -04:00
timmywil
dfeeb872d6 Performance enhancement switching nodeType to a var 2011-04-03 19:13:39 -04:00
timmywil
d28922bc03 Pass jslint, 2 missing semicolons 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
f578e0f997 Don't use extend when setting the action attrHook for IE6/7 2011-04-03 19:13:39 -04:00
timmywil
77c559c3cb No, don't return this. 2011-04-03 19:13:39 -04:00
timmywil
b85d2cd8a5 Simplify jQuery.removeAttr and return this 2011-04-03 19:13:39 -04:00
timmywil
9f88fa9165 Full test suite now passes in all browsers! There are probably some tweaks we can make to shorten and simplify.
- removeAttr now only uses setAttribute if camelCase setAttribute is not supported

  + Might want to rename jQuery.support.getSetAttribute

- tabIndex is a special case now for hooks where undefined should be returned.

  + Should we be checking if hooks returns undefined?  undefined might be the desired return value in future hooks.
    As of now, tabIndex is the only one that needs it, but the test suite will still pass if we don't check if hooks are undefined.
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
ebb8e8e300 Fix feature test, accidentally got rid of closure end 2011-04-03 19:13:39 -04:00
timmywil
00abeaee17 Didn't actually need the hooks anymore 2011-04-03 19:13:38 -04:00
timmywil
4baa213d88 First proposed solution for IE6/7 get/setAttribute quirks. Needs more testing, but solves some issues 2011-04-03 19:13:38 -04:00
timmywil
607210e010 Speed up hasAttr a little 2011-04-03 19:13:38 -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
jeresig
ab4e300919 Very crude first pass at splitting apart the attr/prop logic. Also adding in attrHooks/propHooks. All of it is completely untested. 2011-04-03 19:13:38 -04:00
timmywil
64a0005a3b A more modest valHooks proposal
- The main difference is that this does not allow arbitrarily adding hooks to any collection of elements.

- Modularizes val into a set of easily maintainable and conditional hooks.

- valHooks is placed at jQuery.valHooks

  + This could technically be extended, but I do not see it being used except in very rare cases since you can only apply valHooks to nodeNames and input types, and not a collection of elements as before. We could theoretically privatize valHooks taking it off of jQuery and only use it internally for our own convenience, but again, I do not believe this patch carries with it the dangers of the first proposal.

- Slightly improved performance of val on radios and checkboxes for browsers that support checkOn, given the conditional attachment of its hook.
2011-04-02 17:05:04 -04:00
jeresig
d4e4414451 Very crude first pass at splitting apart the attr/prop logic. Also adding in attrHooks/propHooks. All of it is completely untested. 2011-03-06 22:47:40 -05:00
rwldrn
43a41ba7ec Make sure .val() works after form.reset() in IE. Fixes #2551. 2011-02-10 23:50:02 +01:00
Colin Snover
8e59a99e0a Change the way jQuery.data works so that there is no longer a chance of collision between user data and internal data. Fixes #6968. 2011-01-09 15:52:33 -06:00
Colin Snover
3e0cc81504 Clean trailing whitespace from all files. 2010-12-30 00:34:48 -06:00
Anton M
cc9dbd06e5 Fix attr() problems in IE with attribute nodes. Followup to commit b50f41a2.
IE can't add properties on an attribute-node element, thus we handle it
like text-/comment-nodes.
2010-12-07 03:17:42 +01:00
John Resig
d4a9d45527 Merge branch 'restrictAttr' of https://github.com/jitter/jquery into jitter-restrictAttr 2010-12-06 17:02:00 -05:00
Anton M
df0a3fb853 Handle carriage return characters in className property. Fixes #7673. 2010-12-01 21:31:22 +01:00
Anton M
b50f41a2e3 Make sure attr() works on non DOM element nodes. Fixes #7202, #7451, #7500.
Also added some tests for this attr(name), attr(name, value) and removeAttr(name).
2010-11-13 14:39:28 +01:00
Anton M
49f088f2db Partially revert commit a64dc04050.
Removing the conditional was too liberal as now attr() would even work
on plain javascript objects. Keeping a check to make sure it is at least
a DOM Node is appropriate. Using nodeName as in the commit which introduced
the nodeType === 1 check seems plausible.
2010-11-10 00:36:53 +01:00
Colin Snover
a64dc04050 Remove conditional that prevents attr from working on non-Element nodes. Fixes #7451. 2010-11-09 15:52:20 -05:00
John Resig
fb48ae8e6c Make sure that when multiple variables are being declared that assignments are each done on their own line. 2010-11-09 11:09:07 -05:00
Alex Sexton
086822e641 Moved jQuery.props to attributes since it was only used in support. Fixes #6897 - suggestion by dmethvin 2010-10-25 02:31:19 -05:00
Colin Snover
b03416954d Coerce all array values to strings before comparison in val(). Fixes bug #7123. 2010-10-08 22:48:06 -05:00
John Resig
c7c0677230 Make .attr(name, null) equivalent to removeAttr(name). (Was roughly this before - but is now consistent across platforms). Fixes #6341. 2010-09-28 11:12:13 -04:00
jeresig
d558e9eb6f Some minor cleanup of the last commit. 2010-09-27 10:21:50 -04:00
jeresig
97d468fbf0 Add a feature test for options inside a disabled select. Follow-up to 157a383dae. 2010-09-27 10:19:55 -04:00
jeresig
a384d840d6 Only do the hasAttribute check if the method exists - IE falls back to the === null check below which allows this to still work. Follow-up to cb40495b21 - thanks to @jitter for the catch. 2010-09-27 09:19:21 -04:00
jeresig
157a383dae Bug fix for commit 2c4b20809e - technique wasn't working as expected in WebKit browsers. Thanks to @jitter for the bug fix. 2010-09-27 09:07:54 -04:00
dmethvin
0636dffc24 Make .val(undefined) == .val("") and chainable; fixes #4130.
Ensure .val(null) sets an empty string on IE6/7; fixes #5163.
2010-09-25 05:57:14 +08:00
Dave Methvin
2c4b20809e Don't have .val() return selected-but-disabled options, or selected options inside a disabled optgroup. Doesn't change the .val() returned for a disabled select. Fixes #3240, adapted from Nathan Hammond's patch there. 2010-09-24 17:26:22 -04:00
jeresig
8e1d369710 Some minor lint fixes for the RegExp. 2010-09-22 09:46:21 -04:00
jeresig
9dc6e0c572 Applied the RegExp issues reported by Jeff Robinson here: http://jmrware.com/articles/2010/jqueryregex/jQueryRegexes.html Additionally broke out all remaining inline RegExp. Fixes #7062. 2010-09-22 09:16:28 -04:00
jeresig
a44ec40277 Make sure that jQuery works even when the individual modules are loaded separately AND jQuery.noConflict(true) is used. Fixes #7011. 2010-09-08 12:00:29 -04:00
John Resig
920099b29c First pass at unifying the various CSS methods in jQuery (jQuery.style, jQuery.curCSS, and jQuery.css are now all under jQuery.css). 2010-09-05 10:17:18 -04:00
John Resig
cb40495b21 Make sure that missing attributes return undefined in Blackberry 4.7. Fixes #6938. 2010-08-24 07:28:47 -07:00
John Resig
392174431a .val() on empty options returns the text value rather than the value in Blackberry 4.7. Fixes #6932. 2010-08-23 14:10:39 -07:00
John Resig
396dd21273 Fixing getting/setting classes and makeArray(RegExp) for Blackberry 4.7. Fixes #6930, #6931. 2010-08-23 12:38:55 -07:00
jeresig
8effe3a7de Made it so that you no longer need to build jQuery in order to run the test suite (but you'll still need a checkout of QUnit and Sizzle, at least). 2010-03-23 12:12:16 -04:00
jeresig
437ddb931d No need to run trim on every class iteration in addClass, thanks for the heads-up Leeoniya. 2010-02-13 14:30:27 -05:00
jeresig
83a044f1b5 Make sure that no extra whitespace is leftover after an addClass. Fixes #6050. 2010-02-13 02:18:38 -05:00
tomviner
8a66a30fec spelling mistake (insead) 2010-02-06 10:50:57 +08:00
jeresig
e76ba32ceb Make sure the resulting className from removeClass is nicely trimmed. Fixes #5988. 2010-02-01 21:33:58 -05:00
jeresig
a6ef036bb6 Centralize the logic for throwing exceptions. Fixes #5913. 2010-01-23 16:48:47 -05:00
jeresig
21e15219be Removed .removeAttr(Function), it didn't really make sense. 2010-01-07 11:14:56 -05:00
jeresig
d36b29fa8e Make sure the state is passed in to the toggleClass attribute function. 2010-01-07 11:04:21 -05:00
jeresig
4681216c4b Fixed some bugs relating to the setter arg change in val and html. Also optimized the code in val a bit. 2010-01-07 09:53:16 -05:00
jeresig
2526e29353 Fixing some bugs in the re-tooling of toggleClass, adding in some performance optimizations. 2010-01-06 15:23:30 -05:00
jeresig
600d314538 A first pass at making sure that all the setter function arguments receive the index of the element and a relevant value to work with. Fixes #5763. 2010-01-06 15:08:07 -05:00
jeresig
a00e63ea5a Make a feature detect for the attribute selected code. Fixes #5702. 2009-12-22 15:46:54 -05:00
jeresig
7b0b348419 The option isn't, necessarily, hidden when this occurs. 2009-12-22 15:06:27 -05:00
jeresig
4729f4d443 Make sure that selected works in Safari on options in optgroups. Fixes #5701. 2009-12-22 15:02:52 -05:00
jeresig
e87b090cb7 The logic for specified option values was already handled by .val(), removed the unnecessary code. 2009-12-22 02:03:41 -05:00
jeresig
1e64d58183 Make sure that the correct value is being pulled from checkboxes in Webkit. Fixes #5699. 2009-12-22 02:00:46 -05:00
jeresig
1b67aaee74 Make sure that the correct value is retreived for options that have no value specified, in IE 6. Continues to fix #5697. 2009-12-22 01:28:37 -05:00
jeresig
f298cce100 Made sure that the .val() logic for setting radios and checkboxes was correct. Fixes #5698. 2009-12-22 01:18:49 -05:00
jeresig
261b7efb5f Fixed the issue where getting an empty value was impossible. Fixes #5697. 2009-12-22 00:24:23 -05:00
jeresig
3776cbe314 Standardize on using double-quotes for string literals. 2009-12-21 20:13:16 -05:00