How to extend the web

With the creation of the new Extensible Web W3C Community Group I’d like to outline my personal thoughts about what might be necessary to achieve a standard way for developers to make extensions. For more information about what the group is interested in doing read my post about it.

The following is a description of the elements or components of a framework for creating Prollyfills that I’ll call the Standard Prollyfill Extensible Web framework (SPEW, because I do want this stuff spewed all over the web). Nothing in SPEW currently exists. I’m simply listing out the ideas that I think it would have that would make it successful.


Most Prollyfills in my opinion are going to start with some idea of adding new syntax to one of the existing web technologies. This means that authors will want new things added to HTML, CSS or JavaScript and have them work as though they really are a part of those technologies. This is the kernel of the extension and in most cases will be the most creative part.

There isn’t anything in the SPEW that would be useful to help authors come up with or create the syntactical element of their Prollyfill but there could be tooling built to help authors identify if syntax doesn’t already exist or possibly exists and is just slightly different. I think leveraging the W3C and WHATWG documentation is an obvious part of this tooling and maybe there is something in the SPEW that helps coagulate the authors syntax additions and current standard documentation.


This component of the SPEW is in some respect the most critical. Essentially after the syntax is created a Prollyfill will have to have some way to find it in code. Technically the native parsers built in browsers for HTML, CSS and JavaScript are going to ignore the added syntax (or throw an exception). JavaScript parsers can help here. There are already many really good ones out there. But they are all very specific to an existing technology or they are built to identify just one syntactical token. What is truly necessary here is a SPEW Parser that allows authors to start with good HTML, CSS and JavaScript grammars and add to them in a way that they get the benefit of a good full parse and simple entry points for their syntax changes. The SPEW Parser would also allow the authors to change the traditional object models of the grammar as well so that the result of their parse is a better model. Another feature of the SPEW Parser would be both a runtime and pre-compile ability so authors have options about when their Prolyfills are detected (very much like Sass).

Shameless plug: I’ve created a parsing expression grammar library that I hope to advance enough to be considered for this part of SPEW: Peggy.js


It will be very important that Prollyfills interact with the browser via JavaScript. As such there will be a need for Prollyfill authors to provide an API description of their feature and I think that should be done with Web IDL. This will allow authors to develop and communicate their feature in the language that W3C has chosen to represent object models and functionality. The added benefit of this is that there potentially could be code generation. SPEW could include a Web IDL code generator that allows authors to declare their Prollyfill and then dump out a JavaScript library for use immediately. If integrated with the SPEW Parser there could be a lot of magic done here for authors that would speed up the development of Prolyfills.

Credit to Marcos Caceres. He mentioned the code generation idea on the nExt Web mailing list and I’m glomming on to it here.


Lastly SPEW would contain tooling to deploy and publish a Prollyfill, making it available for the world to use. This part of SPEW would largely copy other package systems and/or simply use them. A large feature of this repository is the ability for runtime inclusion of Prolyfills. Not unlike websites include Facebook and Twitter widgets the SPEW Repository would provide a way for web developers to consume Prolyfills in their own applications.

Note there is a framework out there that has a good start on this: Hitch

Now that the nExt Web group exists, I think that a successful endeavor would be to create a framework that helps with Syntax, Parser, API and Repository. For web developers creating Prolyfills, I believe these are the essential components for success. I hope I’m not alone with these ideas and if you agree then you should participate: If you think these ideas are really bad … you should participate!


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: