Web студия "GrandView"
  Главная   Написать Контакты
   
   
О проекте
Руководство php
 

DOMElement->setIdAttribute()

(no version information, might be only in CVS)

DOMElement->setIdAttribute() -- Declares the attribute specified by name to be of type ID

Описание

class DOMElement {

void setIdAttribute ( string name, bool isId )

}

Declares the attribute name to be of type ID.

Список параметров

name

The name of the attribute.

isId

Set it to TRUE if you want name to be of type ID, FALSE otherwise.

Возвращаемые значения

Эта функция не возвращает значения после выполнения.

Errors/Exceptions

DOM_NO_MODIFICATION_ALLOWED_ERR

Raised if the node is readonly.

DOM_NOT_FOUND

Raised if name is not an attribute of this element.



add a note add a note User Contributed Notes
DOMElement->setIdAttribute()
ElmarHinz
20-May-2007 12:54
The second parameter doesn't exactly do, what you would expect. So use the method with care.

If it is TRUE the method works like a switch.
If it is FALSE the method turns ID setting off.

A unit test demonstrates the exact behaviour:

    public function testSetIdAttribute() {

            $this->assertNull($this->dom->getElementById('testChild'));
            $this->child->setIdAttribute('id', TRUE);   

            $this->assertType('DOMElement', $this->dom->getElementById('testChild'));
            $this->assertNotNull($this->dom->getElementById('testChild'));

      // TRUE switches between on and off, while false turns it off.
            $this->child->setIdAttribute('id', TRUE);   
            $this->assertNull($this->dom->getElementById('testChild'));
            $this->child->setIdAttribute('id', TRUE);   
            $this->assertNotNull($this->dom->getElementById('testChild'));
            $this->child->setIdAttribute('id', TRUE);   
            $this->assertNull($this->dom->getElementById('testChild'));
            $this->child->setIdAttribute('id', TRUE);   
            $this->assertNotNull($this->dom->getElementById('testChild'));

      // FALSE turns off and not on any more.
            $this->child->setIdAttribute('id', FALSE);   
            $this->assertNull($this->dom->getElementById('testChild'));
            $this->child->setIdAttribute('id', FALSE);   
            $this->assertNull($this->dom->getElementById('testChild'));
            $this->child->setIdAttribute('id', FALSE);   
            $this->assertNull($this->dom->getElementById('testChild'));
    }

 
Новости
11 июля 2007
Сайт запущен
© 2007 info@grandviewstudio.com

Deprecated: Function set_magic_quotes_runtime() is deprecated in /home/sites/grandviewstudiocom/www/65f67d67a94ad980786580ae69e11c07/sape.php on line 324

Deprecated: Function set_magic_quotes_runtime() is deprecated in /home/sites/grandviewstudiocom/www/65f67d67a94ad980786580ae69e11c07/sape.php on line 330
Z058440144362 Z348613067571