jQuery: The Write Less, Do More JavaScript Library

Changeset 3856

Show
Ignore:
Timestamp:
11/19/07 16:07:44 (9 months ago)
Author:
brandon.aaron
Message:

Fix for #1944. Added nodeName and tagName to jQuery.props and tests for maxlength, defaultValue, selectedIndex, tagName and nodeName.

Location:
trunk/jquery
Files:
3 modified

Legend:

Unmodified
Added
Removed
  • trunk/jquery/src/core.js

    r3844 r3856  
    12071207        maxlength: "maxLength", 
    12081208        selectedIndex: "selectedIndex", 
    1209         defaultValue: "defaultValue" 
     1209        defaultValue: "defaultValue", 
     1210        tagName: "tagName", 
     1211        nodeName: "nodeName" 
    12101212    } 
    12111213}); 
  • trunk/jquery/test/index.html

    r3839 r3856  
    4141        <ol id="empty"></ol> 
    4242        <form id="form" action="formaction"> 
    43             <input type="text" name="action" value="Test" id="text1"/> 
     43            <input type="text" name="action" value="Test" id="text1" maxlength="30"/> 
    4444            <input type="text" name="text2" value="Test" id="text2" disabled="disabled"/> 
    4545            <input type="radio" name="radio1" id="radio1" value="on"/> 
     
    5656            <button id="button" name="button">Button</button> 
    5757             
    58             <textarea id="area1">foobar</textarea> 
     58            <textarea id="area1" maxlength="30">foobar</textarea> 
    5959             
    6060            <select name="select1" id="select1"> 
  • trunk/jquery/test/unit/core.js

    r3845 r3856  
    224224 
    225225test("attr(String)", function() { 
    226     expect(13); 
     226    expect(20); 
    227227    ok( $('#text1').attr('value') == "Test", 'Check for value attribute' ); 
     228    ok( $('#text1').attr('value', "Test2").attr('defaultValue') == "Test", 'Check for defaultValue attribute' ); 
    228229    ok( $('#text1').attr('type') == "text", 'Check for type attribute' ); 
    229230    ok( $('#radio1').attr('type') == "radio", 'Check for type attribute' ); 
     
    237238    ok( $('#text1').attr('name') == "action", 'Check for name attribute' ); 
    238239    ok( $('#form').attr('action').indexOf("formaction") >= 0, 'Check for action attribute' ); 
     240    ok( $('#text1').attr('maxlength') == '30', 'Check for maxlength attribute' ); 
     241    ok( $('#text1').attr('maxLength') == '30', 'Check for maxLength attribute' ); 
     242    ok( $('#area1').attr('maxLength') == '30', 'Check for maxLength attribute' ); 
     243    ok( $('#select2').attr('selectedIndex') == 3, 'Check for selectedIndex attribute' ); 
     244    ok( $('#foo').attr('nodeName') == 'DIV', 'Check for nodeName attribute' ); 
     245    ok( $('#foo').attr('tagName') == 'DIV', 'Check for tagName attribute' ); 
    239246     
    240247    $('<a id="tAnchor5"></a>').attr('href', '#5').appendTo('#main'); // using innerHTML in IE causes href attribute to be serialized to the full path 
     
    270277 
    271278test("attr(String, Object)", function() { 
    272     expect(12); 
     279    expect(13); 
    273280    var div = $("div"); 
    274281    div.attr("foo", "bar"); 
     
    293300    $("#name").attr('maxlength', '5'); 
    294301    ok( document.getElementById('name').maxLength == '5', 'Set maxlength attribute' ); 
     302    $("#name").attr('maxLength', '10'); 
     303    ok( document.getElementById('name').maxLength == '10', 'Set maxlength attribute' ); 
    295304 
    296305    reset();