Closed Bug 400800 Opened 17 years ago Closed 5 years ago

JavaScript DOM Objects Attributes Limit

Categories

(Core :: DOM: Core & HTML, defect)

x86
Windows XP
defect
Not set
normal

Tracking

()

RESOLVED INCOMPLETE

People

(Reporter: johnmizzi, Unassigned, NeedInfo)

References

()

Details

(Keywords: testcase-wanted)

User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.8.1.8) Gecko/20071008 Firefox/2.0.0.8
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.8.1.8) Gecko/20071008 Firefox/2.0.0.8

The test code supplied in the above URL works in IE and Opera but not Firefox. It seems Firefox javascript has a limit of around 1000 attributes for each DOM Object which might not be enough if you are trying to assemble a windows like system in the browser using DIVs as a window.

Will be great if you can make the DOM attributes unlimited.

Reproducible: Always

Steps to Reproduce:
1.Just run the above code.

Actual Results:  
Dies during the process with no message in the Error Console

Expected Results:  
Unlimited Attributes for JavaScript DOM objects.
Component: General → DOM
Product: Firefox → Core
QA Contact: general → general
The URL given is no longer available. Please attach a testcase.
Keywords: testcase-wanted
Hello Reporter, Above URL http://www.easy-roster.com/test/attrlimit.php is giving 404 error. Can you please provide valid URL in which you see similar issues.
Flags: needinfo?(johnmizzi)
Indeed, Firefox has some limits for attributes in DOM elements. Small testcase:
<script>
	try{
	var el = document.createElement("div");
	var maxAttr = 1024;
	var maxAttrReal = maxAttr - 1;
	for (var i = 0; i < maxAttr; i++){
		el.setAttribute("x" + i, "test");
	}
	console.log("all attr: ", el.attributes.length);
	console.log("has attr_x0: ", el.hasAttribute("x0"));
	console.log("has attr_x1: ", el.hasAttribute("x1"));
	console.log("has attr_x" + maxAttrReal + ": ", el.hasAttribute("x" + maxAttrReal));
	//console.log(el); // watch out in IE11 (output all value may take some time)
	}
	catch(e){
		console.log(e);
	}
</script>

In Firefox more than 1023 attributes per DOM element throw exception "NS_ERROR_FAILURE". In Chrome or IE11 I don't see such small limits. Opera (Presto) is more strict and interesting, set only first 255 attrs, after this value remove all (but not first with index 0) and treat next attrs as new (but max 255).

2019-03-06

This bug is part of a group of bugs which have had an open needinfo for at least 12 weeks.

The request for information has not been answered, and we can't move forward on the bug so we are closing it.

If the defect is still present, please reopen this bug with an updated report.

Status: UNCONFIRMED → RESOLVED
Closed: 5 years ago
Resolution: --- → INCOMPLETE
Component: DOM → DOM: Core & HTML
You need to log in before you can comment on or make changes to this bug.