Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fix for #46: thanks to @will-quast-bohemian for suggested fix

  • Loading branch information...
commit 1f2cdda47257fac2462dd2fb7fc0bdeebac12a56 1 parent 06a4a9b
@filmaj filmaj authored
View
2  VERSION
@@ -1 +1 @@
-2.2.1
+2.2.2
View
12 build
@@ -23,12 +23,12 @@ extra = false
ARGV.each do |arg|
case arg
- when "--minify" then minify = true
- when /^profile=(.*)$/ then profile = $1
- when "--generate-docs" then docs = true
- when /^cat=(.*)$/ then extra = $1
- when "--help" then show_usage
- else
+ when "--minify" then minify = true
+ when /^profile=(.*)$/ then profile = $1
+ when "--generate-docs" then docs = true
+ when /^cat=(.*)$/ then extra = $1
+ when "--help" then show_usage
+ else
STDERR.puts("Invalid parameter '#{arg}'") unless arg == "--help"
show_usage
end
View
3  spec/index-bb.html
@@ -6,7 +6,7 @@
<link rel="stylesheet" href="../packages/qunit/qunit/qunit.css" type="text/css" media="screen" title="no title" charset="utf-8">
<script src="../packages/qunit/qunit/qunit.js" type="text/javascript" charset="utf-8"></script>
<!-- make sure you include the proper build of XUI -->
- <script src="../lib/xui-bb-2.2.0.js" type="text/javascript" charset="utf-8"></script>
+ <script src="../lib/xui-bb-2.2.2.js" type="text/javascript" charset="utf-8"></script>
<script src="tests/core-tests.js" type="text/javascript"></script>
<style>
h2#qunit-banner {
@@ -88,6 +88,7 @@ <h2 id="qunit-userAgent"></h2>
<input type="text" id="text_input" value="initial value" />
<div id="remove-me"></div>
<div id="remove-me-2"></div>
+ <input type="password" id="p" name="p" value="initial" />
</div>
<div id="xhr_tests">
View
3  spec/index-ie.html
@@ -6,7 +6,7 @@
<link rel="stylesheet" href="../packages/qunit/qunit/qunit.css" type="text/css" media="screen" title="no title" charset="utf-8">
<script src="../packages/qunit/qunit/qunit.js" type="text/javascript" charset="utf-8"></script>
<!-- make sure you include the proper build of XUI -->
- <script src="../lib/xui-ie-2.2.0.js" type="text/javascript" charset="utf-8"></script>
+ <script src="../lib/xui-ie-2.2.2.js" type="text/javascript" charset="utf-8"></script>
<script src="tests/core-tests.js" type="text/javascript"></script>
<style>
h2#qunit-banner {
@@ -88,6 +88,7 @@ <h2 id="qunit-userAgent"></h2>
<input type="text" id="text_input" value="initial value" />
<div id="remove-me"></div>
<div id="remove-me-2"></div>
+ <input type="password" id="p" name="p" value="initial" />
</div>
<div id="xhr_tests">
View
3  spec/index.html
@@ -6,7 +6,7 @@
<link rel="stylesheet" href="../packages/qunit/qunit/qunit.css" type="text/css" media="screen" title="no title" charset="utf-8">
<script src="../packages/qunit/qunit/qunit.js" type="text/javascript" charset="utf-8"></script>
<!-- make sure you include the proper build of XUI -->
- <script src="../lib/xui-2.2.0.js" type="text/javascript" charset="utf-8"></script>
+ <script src="../lib/xui-2.2.2.js" type="text/javascript" charset="utf-8"></script>
<script src="tests/core-tests.js" type="text/javascript"></script>
<style>
h2#qunit-banner {
@@ -88,6 +88,7 @@ <h2 id="qunit-userAgent"></h2>
<input type="text" id="text_input" value="initial value" />
<div id="remove-me"></div>
<div id="remove-me-2"></div>
+ <input type="password" id="p" name="p" value="initial" />
</div>
<div id="xhr_tests">
View
10 spec/tests/core-tests.js
@@ -288,7 +288,7 @@ CoreTests.prototype.run = function () {
});
test('.attr()', function() {
- expect(7);
+ expect(9);
var checkbox = x$('#first-check');
checkbox.attr('checked',true);
equals(checkbox[0].checked, true, 'Should be able to check a checkbox-type input element');
@@ -312,6 +312,14 @@ CoreTests.prototype.run = function () {
equals(textInput[0].value, 'some new value', 'using attr() to set value on text inputs should work.');
equals(0, x$('#dom_tests').attr('non-existing').length, 'attr() on non-existing attributes should return xui objects of length 0');
+
+ var pwdInput = document.getElementById('p');
+ var initValue = pwdInput.value;
+ var retrievedValue = x$('#p').attr('value');
+ equals(initValue, retrievedValue, 'attr("value") should return initial value set in a password field');
+
+ pwdInput.value = 'newvalue';
+ equals(pwdInput.value, x$('#p').attr('value'), 'attr("value") should return changed values set in a password field');
});
// --
View
4 src/js/dom.js
@@ -157,7 +157,7 @@ xui.extend({
attr: function(attribute, val) {
if (arguments.length == 2) {
return this.each(function(el) {
- if (el.tagName == 'input' && attribute == 'value') el.value = val;
+ if (el.tagName && el.tagName.toLowerCase() == 'input' && attribute == 'value') el.value = val;
else if (el.setAttribute) {
if (attribute == 'checked' && (val == '' || val == false || typeof val == "undefined")) el.removeAttribute(attribute);
else el.setAttribute(attribute, val);
@@ -166,7 +166,7 @@ xui.extend({
} else {
var attrs = [];
this.each(function(el) {
- if (el.tagName == 'input' && attribute == 'value') attrs.push(el.value);
+ if (el.tagName && el.tagName.toLowerCase() == 'input' && attribute == 'value') attrs.push(el.value);
else if (el.getAttribute && el.getAttribute(attribute)) {
attrs.push(el.getAttribute(attribute));
}
Please sign in to comment.
Something went wrong with that request. Please try again.