<!DOCTYPE html>
<title>My Rockin' Page</title>
<h1>My Rockin' Page</h1>
<p>Hi Prague!</p>
<!DOCTYPE html>
<title>My Rockin' Page</title>
<link rel='stylesheet' href='demo/old-school/big-red-button.css'>
<h1>My Rockin' Page</h1>
<p>Hi Prague!</p>
<!-- or is this in <head>? -->
<script src='demo/old-school/big-red-button.js'></script>
<title>My Rockin' Page</title>
<link rel='stylesheet' href='demo/old-school/big-red-button.css'>
<h1>My Rockin' Page</h1>
<p>I am so hot I spontaneously unbreak symmetry.</p>
<div id="red-button" data-big-red-button="200">Push Me!</div>
<script src='demo/old-school/big-red-button.js'></script>
// make it smaller
$("#red-button").attr("data-big-red-button", "100");
Or...
// add a new button!!!!!
$("<div data-big-red-button=50>Boom?</div>")
.appendTo(document.body);
HTMLElement
!
<big-red-button size="100" id='brb'>
Hit Me!
</big-red-button>
var brb = document.getElementById("brb");
brb.onclick = function () {
brb.setAttribute("size", brb.size === 200 ? "500" : "200");
};
<template>
<style>
.brb {
background: #f00;
font-family: Impact;
color: #fff;
text-align: center;
}
</style>
<div class='brb'><content></content></div>
</template>
var bigRedProto = Object.create(HTMLElement.prototype, {
createdCallback: {
value: function () {
var tmpl = document.importNode(
doc.querySelector("template").content,
true);
this._div = tmpl.querySelector("div.brb");
this.createShadowRoot().appendChild(tmpl);
this.size = this.getAttribute("size") || 100;
}
}
, size: {
enumerable: true
, get: function () { return this._size; }
, set: function (val) {
var s = this._size = parseInt(val || "100", 10)
, st = this._div.style;
st.width = s + "px";
st.height = s + "px";
// more rendering changes
}
}
, attributeChangedCallback: {
value: function (name, oldVal, newVal) {
if (name === "size") this.size = newVal;
}
}
});
document.registerElement("big-red-button",
{ prototype: bigRedProto });
<!DOCTYPE html>
<title>My Rockin' Page</title>
<link rel='import' href='brb-component.html'>
<h1>My Rockin' Page</h1>
<p>Whoa, such component!</p>
<big-red-button size="100" id='attr'>Attr</big-red-button>
<big-red-button size="200" id='brb'>Push Me!</big-red-button>
<script>
// manipulate it directly...
</script>
Isn't this supposed to be an XML conference?
<xml-import …>
registerElementNS()
s/xforms:/xforms-/
It works a lot better than any other option you have to make XML languages work in the browser today.