Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:122418 X-Original-To: internals@lists.php.net Delivered-To: internals@lists.php.net Received: from php-smtp4.php.net (php-smtp4.php.net [45.112.84.5]) by qa.php.net (Postfix) with ESMTPS id B6BF91ADA78 for ; Sat, 17 Feb 2024 23:11:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1708211512; bh=xh7dTTXO2ZYq4D8piJsH4Yy3Yu0iQFyajLCx2D09JaA=; h=Date:From:Subject:To:From; b=I0PfZg5HEjiJOLq4g22ZFentrkNTuVv/qNyfazHYiRAJ4V+O09SXgp5UnanuVQJf3 SceB3BtzLisNgOjRPoKypc3na3valWmrBoWsq5uxyMqOPEhrCA6dp+kvUrZzbKWyOd DwSSKCoVwEUGUCY4xAPRkV0GeGxMqrfRjnU6zJGjsBtbUnHQCHJel1JtdpMn4nXicR McGNm2qAtLfUotNmof/opdrexGCPn51vLFpFgfbqKSiLb03ON834qVC1PUhzjLVAzC wMxhEfSjkUyWHV+8zsYtoko+gY9uVgZVD215C9pIzwvzLS5qWPdpKVJGfaRTXqc4dB ApbVW9aKgqFww== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id C6B1C181FFA for ; Sat, 17 Feb 2024 23:11:49 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 4.0.0 (2022-12-13) on php-smtp4.php.net X-Spam-Level: X-Spam-Status: No, score=0.6 required=5.0 tests=BAYES_50,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,DMARC_PASS,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=4.0.0 X-Spam-Virus: No X-Envelope-From: Received: from mail-wm1-f48.google.com (mail-wm1-f48.google.com [209.85.128.48]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Sat, 17 Feb 2024 15:11:46 -0800 (PST) Received: by mail-wm1-f48.google.com with SMTP id 5b1f17b1804b1-4125df90568so4290095e9.3 for ; Sat, 17 Feb 2024 15:11:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1708211503; x=1708816303; darn=lists.php.net; h=content-transfer-encoding:to:subject:from:content-language :user-agent:mime-version:date:message-id:from:to:cc:subject:date :message-id:reply-to; bh=xh7dTTXO2ZYq4D8piJsH4Yy3Yu0iQFyajLCx2D09JaA=; b=noh11Uw7rOYfOimXiSX7khWIa6Qe54f33+K6fk4jFiOZYwqiEo7kH7Owrw2u4kZ7z7 xokBK294QEZGfhvO3HrtfNP3wl5jAB3nDIXK8yxXhLbR1uLpYf6e+45Ek75ozwJ4H+gu JBu03WgwsBkJJlBmMOI5Q+K064vfx4h54WB8XuPBVgzZ7MrZiYNvQxEmK0xE0zCrgSo5 +7zRANKwq/Ur4x89Gr1LA02UGNe12KOPe3PeXKRdgqleEFDzUP/sd7Y3TD+842DUh2wY mOMoTJIMRyIRjryagK3sQdDQCElzLFsWPlHg9GVdO0EGqHAxgcMhR9vMNf+wfPxsDWzj vGZw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708211503; x=1708816303; h=content-transfer-encoding:to:subject:from:content-language :user-agent:mime-version:date:message-id:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=xh7dTTXO2ZYq4D8piJsH4Yy3Yu0iQFyajLCx2D09JaA=; b=h9XLEiNVKMskj4CRFYGCdMlC0NDtRtFjljuuMoeoJgTRbJE44fvJs+oX1Bl/6dINo9 qMNol/n3COSEV/27R9CVsS0bx92r1h2uBhvsMN/l2+jv82efIv6aU382Uti6bhoN0qfO kqjmVLVA4TTtGRy70vBCvTTS/d4omZ295q1ubvKfmMcZZOGK+VJMpWIHx/U/D/m56c7l bgQy4thnEgYfbHEsXv2ZxgGzravBWH8oqmoREtad7ryeMXgd6G3xCK+iolUwgTnTJZ/q t9ebv80TPy7VfLA4qGP4jMwDN8oCOOP9jsyZYqiPNmltxVLJl7zQCpd1fbzb1CR9WfWz L74w== X-Gm-Message-State: AOJu0YzsPRRAgb7DvMHZx5+UfEPGQ3Gwz1cz2yr1reYUuwkTsvBTVe4k sgor9HBuMhjzQsM/l7VXDyQKNCfWOUCIhZm+yy6N5Dzich/5rmsIYT2VZTpP X-Google-Smtp-Source: AGHT+IG9Br4xZtlcESXynMP7chd2axDtTqlhtHg3Gzj5OB5Cyj8ny7TbnLNe3LfE97UHVNBlZpWyoA== X-Received: by 2002:a5d:4c4e:0:b0:33d:3558:8172 with SMTP id n14-20020a5d4c4e000000b0033d35588172mr1320671wrt.3.1708211502837; Sat, 17 Feb 2024 15:11:42 -0800 (PST) Received: from [192.168.0.59] (178-117-137-225.access.telenet.be. [178.117.137.225]) by smtp.gmail.com with ESMTPSA id k14-20020a5d428e000000b0033ce5b3390esm5958621wrq.38.2024.02.17.15.11.42 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sat, 17 Feb 2024 15:11:42 -0800 (PST) Message-ID: <1b2384c8-bb93-435f-975f-5904297c46be@gmail.com> Date: Sun, 18 Feb 2024 00:11:42 +0100 Precedence: bulk list-help: list-post: List-Id: internals.lists.php.net MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Content-Language: en-US Subject: [PHP-DEV] New ext-dom features To: PHP Internals Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit From: dossche.niels@gmail.com (Niels Dossche) Hi internals After (and if) my current in-voting RFC about spec-compliance DOM passes, some features become more easily possible to implement due to the necessary building blocks becoming in place in the extension code. I would like to start implementing those. Therefore, I'd like to gauge the opinion of the community on the following two features before making an actual RFC and sitting through the process again. 1) Helper functions for CSS classes (i.e. classList). Requested here: https://github.com/php/php-src/issues/11688 This feature would add the DOMTokenList class along with the classList property to the Element class. It exists to ease the managing of CSS classes on elements, i.e. it deals with whitespace, duplicate class names, etc all for you using a simple set-like API. I expect that implementing this into the DOM extension is not too difficult, as the spec steps are really straight-forward [1] and we just have to reuse the internal APIs to manage attributes. 2) Built-in CSS selector API support In particular, Element::querySelector(All), Element::matches, and Element::closest support. For "old DOM" there is a trick to at least implement querySelector(All) in userland, and that is to translate the selector to XPath and use XPath queries internally. However, that's slower and more cumbersome than a native implementation. It's also just silly to not have this natively available since it's so commonly used. I have a prototype implementation of this already actually, because I got bored while fixing spec-compliance issues and wanted some funner stuff to do. It's based on Lexbor's CSS support. Kind regards Niels [1] https://dom.spec.whatwg.org/#interface-domtokenlist