Created
          September 7, 2012 21:04 
        
      - 
      
- 
        Save godmar/3669613 to your computer and use it in GitHub Desktop. 
    possible fix for checked attribute
  
        
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | diff --git a/lib/jsdom/level2/html.js b/lib/jsdom/level2/html.js | |
| index 6d92a8f..ae7e38a 100644 | |
| --- a/lib/jsdom/level2/html.js | |
| +++ b/lib/jsdom/level2/html.js | |
| @@ -848,11 +848,14 @@ define('HTMLInputElement', { | |
| return this._initDefaultChecked(); | |
| }, | |
| get checked() { | |
| - return !!this.getAttribute('checked'); | |
| + return !!this._attributes.getNamedItem('checked'); | |
| }, | |
| set checked(checked) { | |
| this._initDefaultChecked(); | |
| - this.setAttribute('checked', checked); | |
| + if (checked) | |
| + this.setAttribute('checked', 'checked'); | |
| + else | |
| + this.removeAttribute('checked'); | |
| }, | |
| get value() { | |
| return this.getAttribute('value'); | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment