Skip to content

Dom\HTMLElement::getElementsByClassName() not implemented #18550

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
cscott opened this issue May 13, 2025 · 0 comments
Open

Dom\HTMLElement::getElementsByClassName() not implemented #18550

cscott opened this issue May 13, 2025 · 0 comments

Comments

@cscott
Copy link
Contributor

cscott commented May 13, 2025

Description

The following code:

<?php
$doc = Dom\HTMLDocument::createFromString('');
$el = $doc->createElement('div');
$el->getElementsByClassName('foo');
echo("Success.\n");

Resulted in this output:

Error  Call to undefined method Dom\HTMLElement::getElementsByClassName().

But I expected this output instead:

Success.

Documentation for this method is at: https://developer.mozilla.org/en-US/docs/Web/API/Element/getElementsByClassName
and it is standardized at https://dom.spec.whatwg.org/#ref-for-dom-element-getelementsbyclassname

PHP Version

PHP 8.4.6 (cli) (built: Apr 11 2025 02:19:40) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.4.6, Copyright (c) Zend Technologies
    with Zend OPcache v8.4.6, Copyright (c), by Zend Technologies

Operating System

Ubuntu 24.04.2 LTS

@cscott cscott changed the title Dom\Document loses case distinctions of attributes named /xmlns/i Dom\HTMLElement::getElementsByClassName() not implemented May 13, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants