xref: /PHP-8.4/ext/dom/tests/bug79701/toggle.phpt (revision 8dc2391b)
1--TEST--
2Bug #79701 (getElementById does not correctly work with duplicate definitions) - toggle variation
3--EXTENSIONS--
4dom
5--FILE--
6<?php
7$dom = Dom\HTMLDocument::createFromString('<p id="test">foo</p>', LIBXML_NOERROR | LIBXML_HTML_NOIMPLIED);
8var_dump($dom->getElementById('test')?->nodeName);
9$dom->documentElement->toggleAttribute('id');
10var_dump($dom->getElementById('test')?->nodeName);
11$dom->documentElement->toggleAttribute('id');
12var_dump($dom->getElementById('test')?->nodeName);
13?>
14--EXPECT--
15string(1) "P"
16NULL
17NULL
18