jsdom
Advanced tools
Comparing version 0.5.0 to 0.5.1
@@ -702,3 +702,3 @@ var core = require("./core").dom.level2.core, | ||
return this.options._toArray().reduceRight(function(prev, option, i) { | ||
return option.defaultSelected ? i : prev; | ||
return option.selected ? i : prev; | ||
}, -1); | ||
@@ -831,3 +831,3 @@ }, | ||
if (options.item(0) === this) { | ||
if (options.item(0) === this && !select.hasAttribute('multiple')) { | ||
var found = false, optArray = options._toArray(); | ||
@@ -914,2 +914,10 @@ | ||
this.setAttribute('checked', 'checked'); | ||
if (this.type === 'radio') { | ||
var elements = this._ownerDocument.getElementsByName(this.name); | ||
for (var i = 0; i < elements.length; i++) { | ||
if (elements[i] !== this && elements[i].tagName === "INPUT" && elements[i].type === "radio") { | ||
elements[i].checked = false; | ||
} | ||
} | ||
} | ||
} else { | ||
@@ -939,6 +947,16 @@ this.removeAttribute('checked'); | ||
}, | ||
_dispatchClickEvent: function() { | ||
var event = this._ownerDocument.createEvent("HTMLEvents"); | ||
event.initEvent("click", true, true); | ||
this.dispatchEvent(event); | ||
}, | ||
click: function() { | ||
if (this.type === 'checkbox' || this.type === 'radio') { | ||
if (this.type === 'checkbox') { | ||
this.checked = !this.checked; | ||
} | ||
else if (this.type === 'radio') { | ||
this.checked = true; | ||
} | ||
else if (this.type === 'submit') { | ||
@@ -950,2 +968,3 @@ var form = this.form; | ||
} | ||
this._dispatchClickEvent(); | ||
} | ||
@@ -952,0 +971,0 @@ }, |
{ | ||
"name": "jsdom", | ||
"version": "0.5.0", | ||
"version": "0.5.1", | ||
"description": "A JavaScript implementation of the W3C DOM", | ||
@@ -164,2 +164,7 @@ "keywords": [ | ||
"url" : "https://github.com/chad3814" | ||
}, | ||
{ | ||
"name": "Zach Smith", | ||
"email": "x.coder.zach@gmail.com", | ||
"url": "https://github.com/xcoderzach" | ||
} | ||
@@ -166,0 +171,0 @@ ], |
@@ -292,6 +292,5 @@ # jsdom | ||
browser/contextifyReplacement 4/4 100% | ||
browser/index 22/22 100% | ||
browser/index 34/34 100% | ||
------------------------------------------------------ | ||
TOTALS: 0/2568 failed; 100% success | ||
TIME: 32648ms | ||
TOTALS: 0/2580 failed; 100% success | ||
``` | ||
@@ -298,0 +297,0 @@ |
347314
10045
335