Opened 11 years ago
Closed 11 years ago
#12086 closed bug (invalid)
Checking value for null after using property of value. Method "attr"
Reported by: | Owned by: | ||
---|---|---|---|
Priority: | low | Milestone: | None |
Component: | attributes | Version: | 1.7.2 |
Keywords: | Cc: | ||
Blocked by: | Blocking: |
Description
Checking value for null after using property of value. There is next code (start from 2511 row) in current version (source code, but in min version code is same):
attr: function( elem, name, value, pass ) { var ret, hooks, notxml, nType = elem.nodeType; // don't get/set attributes on text, comment and attribute nodes if ( !elem || nType === 3 || nType === 8 || nType === 2 ) { return; }
For getting nType value used elem.nodeType, but elem didn't check for null before. It will checked after that (in the next rows). It seems that it should be lik this:
if ( !elem) return; var ret, hooks, notxml, nType = elem.nodeType; if(nType === 3 || nType === 8 || nType === 2 ) { return; }
Change History (5)
comment:1 Changed 11 years ago by
Owner: | set to [email protected]… |
---|---|
Status: | new → pending |
comment:2 Changed 11 years ago by
ok, just I use jqGrid and it call this method with null value. I looked to version 1.5.2 and this have checking for null or undefined first here.
But anyway maybe it is right to do checking elem, and than get his property?
comment:3 Changed 11 years ago by
Component: | unfiled → attributes |
---|---|
Priority: | undecided → low |
null shouldn't be getting passed as an element reference to attr() and if jqGrid is doing this then they should be updating their code to perform checks on the input being passed through through the chain. imo, the current behavior shouldn't change. Garbage in, garbage out :)
comment:5 Changed 11 years ago by
Resolution: | → invalid |
---|---|
Status: | pending → closed |
What code is this affecting? Since
null
is not an element it shouldn't be passed there.