Edit report at http://bugs.php.net/bug.php?id=54698&edit=1
ID: 54698 Updated by: [email protected] Reported by: broshizzledizzle at gmail dot com Summary: setAttribute -Status: Open +Status: Wont fix Type: Feature/Change Request Package: DOM XML related Operating System: (irrelevant) PHP Version: Irrelevant Block user comment: N Private report: N New Comment: Given how widely the DOM extension is used, I don't think it would be a good idea to break backward compatibility now, even in a good cause. Closing won't fix. Previous Comments: ------------------------------------------------------------------------ [2011-05-10 00:15:28] broshizzledizzle at gmail dot com Description: ------------ It makes more sense for setAttribute() to return the object it was called on instead of the attribute that was set. If I was interested in the attribute, I'd have use createAttribute() instead. Test script: --------------- $dom = new DOMDocument(); $body = $dom->createElement('body'); $dom->appendChild($body->setAttribute('class', 'wrapper')); echo $dom->saveHTML(); Expected result: ---------------- I would expect that it would properly append $body to the $dom. Actual result: -------------- Warning: DOMNode::appendChild() [domnode.appendchild]: Couldn't append node in _FILE_ on _LINE_. ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/bug.php?id=54698&edit=1
