51 lines
No EOL
965 B
HTML
51 lines
No EOL
965 B
HTML
<!DOCTYPE HTML>
|
|
<html>
|
|
<body>
|
|
|
|
<template id="tmpl">
|
|
<style>
|
|
.content {
|
|
min-height: 20px;
|
|
padding: 19px;
|
|
margin-bottom: 20px;
|
|
background-color: #f5f5f5;
|
|
border: 1px solid #e3e3e3;
|
|
border-radius: 4px;
|
|
box-shadow: inset 0 1px 1px rgba(0, 0, 0, .05);
|
|
}
|
|
|
|
:host {
|
|
display: block;
|
|
}
|
|
|
|
:host(.info) .content {
|
|
color: green;
|
|
}
|
|
|
|
:host(.warning) .content {
|
|
color: red;
|
|
}
|
|
</style>
|
|
<div class="content"><content></content></div>
|
|
</template>
|
|
|
|
<script>
|
|
!function() {
|
|
var localDocument = document.currentScript.ownerDocument;
|
|
var tmpl = localDocument.getElementById('tmpl');
|
|
|
|
var MessageProto = Object.create(HTMLElement.prototype);
|
|
|
|
MessageProto.createdCallback = function() {
|
|
var root = this.createShadowRoot();
|
|
root.appendChild(tmpl.content.cloneNode(true));
|
|
};
|
|
|
|
document.registerElement('ui-message', {
|
|
prototype: MessageProto
|
|
});
|
|
}();
|
|
</script>
|
|
|
|
</body>
|
|
</html> |