Web Components specifications in 2023 - Custom Elements

Hello,

I would reply to this post but the reply button is broken in Chrome and Firefox on Linux.....

If I am out of date or have misunderstood then please accept my apologies in advance.

I want to do make the following custom element in Safari but it is apparently not currently supported for "ideological" reasons ?

class my_special_element extends HTMLInputElement {

	myCustomFunction(){
		self.value="Oh look, I have extended the element class with a new method";
	}

}

//Then in HTML

<input is="my-special-element">

I can already, easily extend web components in Safari right now by doing the following - as I have been doing for the past 15 years in all browsers.

function my_special_element_pretend_class(element) {

	self=element;

	self.myCustomFunction=function(){
		self.value="Oh look, I have extended the element class with a new method";
	}

	return self;

}

//In this case myElement is an "input" element.
var myElement = document.getElementById('myElement');

myElement=my_special_element_pretend_class(myElement);
myElement.myCustomFunction();

Given that this is so unbelievably easy to do, why is Apple adopting a stance at odds with the W3C over Web Components ?

If you're HONESTLY worried about namespace collisions then surely just throw an exception ? Don't we already have to stay on top of bugs caused by new features etc ?

Security ? Really ? Please read the code above again ! Surely you'd have to fundamentally alter the core extensibility of Javascript to keep yourself safe from that ?

We all breathed a massive sigh of relief when Microsoft killed IE11. Is Safari going to become the hated reason for another zillion bloated, resource consuming polyfills that slow down the UI ONLY on YOUR devices ?

Best wishes

Chris

Web Components specifications in 2023 - Custom Elements
 
 
Q