Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:122431 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 858AE1ACEBF for ; Sun, 18 Feb 2024 17:26:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1708277185; bh=Qn2U398tHXtpR52rkEyLbvn+j+777I9cZwhIvZvN0c0=; h=In-Reply-To:References:Date:From:To:Subject:From; b=HAMoOZpAO2WGg6foGO0XE2pxlxW/So45TMOhY42wqZ/BNMDg22+08gou2EsEP0j4B Aut4hpS4tt4QyGpuOrL2hzXXaMwn5KMyka6fl3/aFQ8NzP5rVTuyRNTrCPuMy6VXCz Qxo26YZJV2PR0bF6RmkdxzdWnJyrlpBQsraGqjYQ1la+DxsBnj8EHpKcirqinGocg9 zO/ViQGR0QMJpDF0nSK/wZfSck34E9NdfCoct1In8rzyZ5JtDpjUTzOGiVeF6zeEGt PYCuW2QbmPRXbhCjHfGRG54CnX3U14quW7AGRn5yibfHmLLirr5Jrep2/x9RSN5rkk kvbxdSIOYX3Ow== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id EDD8D18005B for ; Sun, 18 Feb 2024 17:26:23 +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=-1.4 required=5.0 tests=BAYES_05,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,DMARC_MISSING,RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_PASS,SPF_NONE, T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=4.0.0 X-Spam-Virus: No X-Envelope-From: Received: from out1-smtp.messagingengine.com (out1-smtp.messagingengine.com [66.111.4.25]) (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 ; Sun, 18 Feb 2024 09:26:23 -0800 (PST) Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.nyi.internal (Postfix) with ESMTP id F048C5C005A for ; Sun, 18 Feb 2024 12:26:18 -0500 (EST) Received: from imap50 ([10.202.2.100]) by compute1.internal (MEProxy); Sun, 18 Feb 2024 12:26:18 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= garfieldtech.com; h=cc:content-type:content-type:date:date:from :from:in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:subject:subject:to:to; s=fm1; t=1708277178; x= 1708363578; bh=uci5T5ZJbByi7O+eqK1iRVAhZuo7mHoqxYJP9ciaTDw=; b=t 20YMkH+gqaRlBae6dlU3lwCgLjwIjl9m7GZvGLn2bOUyuudFZpRgAvzAl7haKZZB BL1qgT9YUm8zL0B+paU5gAC5UWi/l/TAgK7lHSWPPUJDGKyZgmroDdw/RMIYjwcq ioRZIrB5s7Q2fk3HcuoPK4Sok3Rqfzdzx7uxzZ3G8MiyYeaavwRCu6k7PXYCvdr3 DcL+177qAzr46VO8LygbNsCEyA64q9f1TkXHLCE/EzTF97MBCIdfQgtj0H1y5Tc7 RIcmmFvjCIuolHxYQrRzadQpbxIlMBQ2f+ArC20kuwRhohY9+iOgubRwP0jahzJM nRLhsZLpwREFMCtepV93g== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:content-type:date:date :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:subject:subject:to :to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm1; t=1708277178; x=1708363578; bh=uci5T5ZJbByi7O+eqK1iRVAhZuo7 mHoqxYJP9ciaTDw=; b=SKmad7mKPEgBHzAY60sV4mgltT6LbF0sgIH9s9nFEKJP 3g82zZTZ0r6RFK9GIgQT12p2yq3Twxpk7W/wjR8VrzRnNRRplMZFVXI8zJY/jJ0N ZkGO6oDIO9od9vTDN2z1zogkvlRq519b8FsD+GXYDIeiusCu31Rl4fk3NsbbLvsX SQtM1bVJXZSw3XMMsO1f4te8b063Fh09BlLiFsSWZhEWgYIiY6pkw+6tBTrS0Gqj v31QMI3AOF6rDGLuXlH80jwZHQ1COSoKEjnwuvIzDytS1Ah0aJ4uD//VL7sAZTjx 7jfNqDNzniLGUNar3X/4fZi5W4kkjh7o9BZQNBYIAQ== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvledrvdeigddutdefucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepofgfggfkjghffffhvffutgesthdtredtreertdenucfhrhhomhepfdfnrghr rhihucfirghrfhhivghlugdfuceolhgrrhhrhiesghgrrhhfihgvlhguthgvtghhrdgtoh hmqeenucggtffrrghtthgvrhhnpeejleelgeffkeegfeeukeevteduffdugfeijeellefg heeigffgjedtleehjeelgeenucffohhmrghinhepghhithhhuhgsrdgtohhmpdifhhgrth ifghdrohhrghenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhr ohhmpehlrghrrhihsehgrghrfhhivghlughtvggthhdrtghomh X-ME-Proxy: Feedback-ID: i8414410d:Fastmail Received: by mailuser.nyi.internal (Postfix, from userid 501) id AE8201700093; Sun, 18 Feb 2024 12:26:18 -0500 (EST) X-Mailer: MessagingEngine.com Webmail Interface User-Agent: Cyrus-JMAP/3.11.0-alpha0-144-ge5821d614e-fm-20240125.002-ge5821d61 Precedence: bulk list-help: list-post: List-Id: internals.lists.php.net MIME-Version: 1.0 Message-ID: In-Reply-To: <1b2384c8-bb93-435f-975f-5904297c46be@gmail.com> References: <1b2384c8-bb93-435f-975f-5904297c46be@gmail.com> Date: Sun, 18 Feb 2024 11:25:58 -0600 To: "php internals" Subject: Re: [PHP-DEV] New ext-dom features Content-Type: text/plain From: larry@garfieldtech.com ("Larry Garfield") On Sat, Feb 17, 2024, at 5:11 PM, Niels Dossche wrote: > 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 I feel like the CSS-based querySelector() was discussed not that long ago. Was it by you? Lexbor sounds familiar. Either way, I'm +1 on including a CSS selector natively. --Larry Garfield