Firebug HTML Tab Doesn't Dynamically Update 'value' Attribute

79 views
Skip to first unread message

thejusme

unread,
Feb 5, 2015, 4:56:43 PM2/5/15
to fir...@googlegroups.com
If you have JS that dynamically updates the 'value' attribute of an input (I tested with a text input), the HTML tab in Firebug will continue to display only the default value. For example:

--- BEGIN HTML ---
<html>
<head>
<script>

function changestuff()
{
        var obj = document.getElementById('textbox');
        obj.value = '';
        obj.className = 'test';
}

</script>
</head>
<body>
<input id='textbox' value='stuff'>
<input type='button' value='change textbox value' onclick='changestuff()'>
</body>
</html>
--- END HTML ---

Steps to reproduce:

1.) Open Firefox with the above HTML
2.) Inspect the 'textbox' element in Firebug
3.) Click the 'change textbox value' button
4.) Notice that the HTML displayed in Firebug is still: "<input id='textbox' value='stuff'>" when it should be: "<input id='textbox' value=''>"

Not sure if this happens with other tags or attributes. I swear this is new behavior, but I could be going crazy. I guess there could be some discussion as to the expected behavior here; whether Firebug should keep displaying the default value or the actual value. My vote would obviously be for Firebug to represent 100% what is actually displayed in the browser, as it does in all other cases that I know of.

Sebastian Zartner

unread,
Feb 6, 2015, 9:04:14 AM2/6/15
to fir...@googlegroups.com
What you're updating in your example script is the DOM value, not the HTML attribute. I admit that this might be confusing at first sight, though what you see is the expected behavior. See comment 13 of issue 4165 for a more detailed description why.

Btw. a similar thing happens for <textarea>. Compare the textContent property with the value property.

Sebastian
Reply all
Reply to author
Forward
0 new messages