Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:122437 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 3EE071ACEBF for ; Mon, 19 Feb 2024 18:28:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1708367316; bh=t3VbWpdhXl72Ftm1KOocN4O0einYgXRUkugNd0d0HOs=; h=Date:Subject:To:References:From:In-Reply-To:From; b=OUKx93FG6R8UGY2ndTmPDHCQTTVcnqwUG1/2yHpaE+obFiwt5wDwIPxBXXHtTZWNv bB6eh9lJo8tSdFu/haWyRVlLNi/pjhuuieXXQOTRaCg1ALjVfPuxxEMWlhA6tbjBwy m0gL0yJqKl9n1ghsxHuFzng0pozNt4fS7r65ShUC2OV7jutwEFj/0ACgjW4yrGftL5 R3uFDR1nz294qfqQmSzCRk5WGvHHP1d6RmkPJTrjYrTTKIg3nPNiUqx5dcSQ3XmQSq 4+rVnjP7atvhcjq4wNSdINa/5NItmrL2COd8JoKYVsncjsokEo0gmxDCokhbbD3OP6 FRorUUUAFE7nA== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 5AAD618006B for ; Mon, 19 Feb 2024 18:28:35 +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.2 required=5.0 tests=BAYES_20,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-lf1-f42.google.com (mail-lf1-f42.google.com [209.85.167.42]) (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 ; Mon, 19 Feb 2024 10:28:34 -0800 (PST) Received: by mail-lf1-f42.google.com with SMTP id 2adb3069b0e04-512bfc18438so135250e87.1 for ; Mon, 19 Feb 2024 10:28:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1708367309; x=1708972109; darn=lists.php.net; h=content-transfer-encoding:in-reply-to:from:content-language :references:to:subject:user-agent:mime-version:date:message-id:from :to:cc:subject:date:message-id:reply-to; bh=prRkbP55V+4ArgWbg54kw/V5rHrvelSENjN/FNS+vp0=; b=LPW4xH5+rXdjLpyyNwO0T6p66g9VwFKR215qE0A+Zf/Vuaw+4Acxd/oLCIbwvVHADZ IHrsfdzrrYLg7lAsvTxXcPCoLDr234vahcMeE5ljUXg5gbFEIo1llUdJNNVBV12K4lOt /MnWw5bwM7xEYQ36IaI9sRLLlfoSrw00zzkBpx1TskOfcld0NmxHftlv/K1oHQrqAxAf fNdyajlgyomMOryiyVVLc24ImQENE1dn95jbRyXQMS3SAsmOR8OWpijZV4IPxeisHrvR QtrmFpU3E0SJEP1CKwH2AcigeP5UpFrgTIxY9YImkwZ4qxQrC56hCH0K/c4lRwf+S0Bl 9bIA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708367309; x=1708972109; h=content-transfer-encoding:in-reply-to:from:content-language :references:to:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=prRkbP55V+4ArgWbg54kw/V5rHrvelSENjN/FNS+vp0=; b=mkShBRUKbs19Wb2OilpJ9C0F6W5ESiwva9Gf5shXR3CXN8ftyRp8Zr7fuEDB3IsRQ2 K8b2unVj2szXNuxq38YkeQ8vdbT6nwzr8lmp0/DcGYa4O7tCx9valHS4OUGX1AwDjGNU DNUi0H60Oj0Ddj3nBmq3khrqihbMDaJiOWKeAAHk7lIYfnM7STgiWacZa3VzqzH0A6FP TehvInhi7cxK2sCcKvA91HKOJZEPF9AX4UtitxQ4NaNGRiZOWixuQUln5Ezfmo2S7es8 /eRO5v5BKNarTuKB5tGUC5wc07hJr8N7/2fC6TUxnna16rrSRDSc7KbwCHU8SspcsgGK pSKA== X-Gm-Message-State: AOJu0YwRcmAPgugSLLaGPaCVIuanRqwJJHToEJoH8cEdIo+ff7FYYLqp dirRPNvFzgWSwZz6yJr8DBO5Hffx0/k2lWT70gBSXEOCRQAkKiI2aGRKmdSb X-Google-Smtp-Source: AGHT+IGvF2DHI/hpY72ZiwTKlk3594iAsokbWKgbW/5q6jVntLVwyh2en8TG29Kdc6pucxgLdllpjQ== X-Received: by 2002:a05:651c:1423:b0:2d2:39e6:fa3f with SMTP id u35-20020a05651c142300b002d239e6fa3fmr2030335lje.31.1708367309182; Mon, 19 Feb 2024 10:28:29 -0800 (PST) Received: from ?IPV6:2a02:1811:cc83:ee30:8e76:2662:766d:ebaa? (ptr-dtfv04vjm7u23t23d7u.18120a2.ip6.access.telenet.be. [2a02:1811:cc83:ee30:8e76:2662:766d:ebaa]) by smtp.gmail.com with ESMTPSA id r17-20020a05600c459100b004124907f43fsm11466883wmo.12.2024.02.19.10.28.28 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 19 Feb 2024 10:28:28 -0800 (PST) Message-ID: <1b619316-9c28-4a58-beeb-3102ce214b1d@gmail.com> Date: Mon, 19 Feb 2024 19:28:28 +0100 Precedence: bulk list-help: list-post: List-Id: internals.lists.php.net MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PHP-DEV] New ext-dom features To: internals@lists.php.net References: <1b2384c8-bb93-435f-975f-5904297c46be@gmail.com> Content-Language: en-US In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit From: dossche.niels@gmail.com (Niels Dossche) Hi Larry On 18/02/2024 18:25, Larry Garfield wrote: > 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. I have mentioned it in the past, I couldn't find another discussion specifically about it on externals.io. So it was probably me :-) As for Lexbor, I did mention it both in my current RFC and previous RFC. In short: it's the library allowing us to have HTML5 support. Cheers Niels > > Either way, I'm +1 on including a CSS selector natively. >