Skip to content
This repository has been archived by the owner on Mar 13, 2018. It is now read-only.

Commit

Permalink
tweak comment formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
Scott J. Miles committed Apr 6, 2014
1 parent 97b5266 commit a9726cb
Showing 1 changed file with 124 additions and 124 deletions.
248 changes: 124 additions & 124 deletions core-layout.html
Original file line number Diff line number Diff line change
Expand Up @@ -145,138 +145,138 @@
---------------------------------
@element core-layout
-->
<--
If true, the host element of the core-layout element becomes a
flexbox. Apply additional layout classes to the host element to customize
its styling.

@attribute host
@type boolean
@default false
-->

<link rel="import" href="../polymer/polymer.html">

<polymer-element name="core-layout" attributes="flow justify align isContainer">

<template>

<link no-shim rel="stylesheet" href="core-layout.css">
<link no-shim rel="stylesheet" href="core-layout-host.css">

</template>

<script>

(function() {

Polymer('core-layout', {

isContainer: false,
/**
* Controls how the element lays out or flows. Set to `h` for a
* horizontal flow or `v` for a vertical flow.
*
* @attribute flow
* @type string h|v
* @default ''
*/
flow: '',
/**
* Controls how the items are aligned in the flow direction. For
* example for a flow of `h`, this controls how each item is aligned
* horizontally.
*
* @attribute justify
* @type string start|center|end|between
* @default ''
*/
justify: '',
/**
* Controls how the items are aligned in cross-flow direction. For
* example for a flow of `h`, this controls how each item is aligned
* vertically.
*
* @attribute align
* @type string start|center|end
* @default ''
*/
align: '',
/**
* Controls whether or not the items layout in reverse order.
*
* @attribute reverse
* @type boolean
* @default false
*/
reverse: false,
layoutPrefix: 'core-',

// NOTE: include template so that styles are loaded, but remove
// so that we can decide dynamically what part to include
registerCallback: function(polymerElement) {
var template = polymerElement.querySelector('template');
this.styles = template.content.querySelectorAll('style').array();
this.styles.forEach(function(s) {
s.removeAttribute('no-shim');
})
},

fetchTemplate: function() {
return null;
},

attached: function() {
this.installScopeStyle(this.styles[0]);
if (this.children.length) {
this.isContainer = true;
}
var container = this.isContainer ? this : this.parentNode;
// detect if laying out a shadowRoot host.
var forHost = container instanceof ShadowRoot;
if (forHost) {
this.installScopeStyle(this.styles[1], 'host');
container = container.host || document.body;
}
this.layoutContainer = container;
},

detached: function() {
this.layoutContainer = null;
},

layoutContainerChanged: function(old) {
this.style.display = this.layoutContainer === this ? null : 'none';
this.flowChanged();
this.alignChanged();
this.justifyChanged();
},
setLayoutAttribute: function(name, value) {
if (this.layoutContainer && name) {
if (value) {
this.layoutContainer.setAttribute(this.layoutPrefix + name, value);
} else {
this.layoutContainer.removeAttribute(name);
}
<template>

<link no-shim rel="stylesheet" href="core-layout.css">
<link no-shim rel="stylesheet" href="core-layout-host.css">

</template>
<script>

Polymer('core-layout', {
/**
* If true, the host element of the core-layout element becomes a
* flexbox. Apply additional layout classes to the host element to customize
* its styling.
*
* @attribute host
* @type boolean
* @default false
*/

/**
* Controls how the element lays out or flows. Set to `h` for a
* horizontal flow or `v` for a vertical flow.
*
* @attribute flow
* @type string h|v
* @default ''
*/
flow: '',

/**
* Controls how the items are aligned in the flow direction. For
* example for a flow of `h`, this controls how each item is aligned
* horizontally.
*
* @attribute justify
* @type string start|center|end|between
* @default ''
*/
justify: '',

/**
* Controls how the items are aligned in cross-flow direction. For
* example for a flow of `h`, this controls how each item is aligned
* vertically.
*
* @attribute align
* @type string start|center|end
* @default ''
*/
align: '',

/**
* Controls whether or not the items layout in reverse order.
*
* @attribute reverse
* @type boolean
* @default false
*/
reverse: false,

isContainer: false,

layoutPrefix: 'core-',

// NOTE: include template so that styles are loaded, but remove
// so that we can decide dynamically what part to include
registerCallback: function(polymerElement) {
var template = polymerElement.querySelector('template');
this.styles = template.content.querySelectorAll('style').array();
this.styles.forEach(function(s) {
s.removeAttribute('no-shim');
})
},

fetchTemplate: function() {
return null;
},

attached: function() {
this.installScopeStyle(this.styles[0]);
if (this.children.length) {
this.isContainer = true;
}
var container = this.isContainer ? this : this.parentNode;
// detect if laying out a shadowRoot host.
var forHost = container instanceof ShadowRoot;
if (forHost) {
this.installScopeStyle(this.styles[1], 'host');
container = container.host || document.body;
}
this.layoutContainer = container;
},

detached: function() {
this.layoutContainer = null;
},

layoutContainerChanged: function(old) {
this.style.display = this.layoutContainer === this ? null : 'none';
this.flowChanged();
this.alignChanged();
this.justifyChanged();
},

setLayoutAttribute: function(name, value) {
if (this.layoutContainer && name) {
if (value) {
this.layoutContainer.setAttribute(this.layoutPrefix + name, value);
} else {
this.layoutContainer.removeAttribute(name);
}
},

flowChanged: function() {
this.setLayoutAttribute('flow', this.flow || 'h');
},
}
},

alignChanged: function() {
this.setLayoutAttribute('align', this.align);
},
flowChanged: function() {
this.setLayoutAttribute('flow', this.flow || 'h');
},

justifyChanged: function() {
this.setLayoutAttribute('justify', this.justify);
}
alignChanged: function() {
this.setLayoutAttribute('align', this.align);
},

});
justifyChanged: function() {
this.setLayoutAttribute('justify', this.justify);
}

})();
</script>
});

</script>
</polymer-element>

0 comments on commit a9726cb

Please sign in to comment.