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

Commit

Permalink
Merge pull request #20 from Polymer/master
Browse files Browse the repository at this point in the history
6/17 master -> stable
  • Loading branch information
dfreedm committed Jun 17, 2013
2 parents 31df195 + 569a80a commit 35c5280
Show file tree
Hide file tree
Showing 34 changed files with 594 additions and 86 deletions.
21 changes: 0 additions & 21 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,24 +1,3 @@
[submodule "ShadowDOM"]
path = ShadowDOM
url = https://github.com/Polymer/ShadowDOM.git
[submodule "CustomElements"]
path = CustomElements
url = https://github.com/Polymer/CustomElements.git
[submodule "PointerGestures"]
path = PointerGestures
url = https://github.com/Polymer/PointerGestures.git
[submodule "MDV"]
path = MDV
url = https://github.com/Polymer/mdv.git
[submodule "WebAnimations"]
path = WebAnimations
url = https://github.com/web-animations/web-animations-js.git
[submodule "HTMLImports"]
path = HTMLImports
url = https://github.com/Polymer/HTMLImports.git
[submodule "buildbot"]
path = buildbot
url = https://github.com/Polymer/buildbot.git
[submodule "tools"]
path = tools
url = https://github.com/Polymer/tools.git
1 change: 0 additions & 1 deletion CustomElements
Submodule CustomElements deleted from ab46c7
1 change: 0 additions & 1 deletion HTMLImports
Submodule HTMLImports deleted from 753e58
1 change: 0 additions & 1 deletion MDV
Submodule MDV deleted from 2767ae
1 change: 0 additions & 1 deletion PointerGestures
Submodule PointerGestures deleted from 09ba72
1 change: 0 additions & 1 deletion ShadowDOM
Submodule ShadowDOM deleted from 7e318b
1 change: 0 additions & 1 deletion WebAnimations
Submodule WebAnimations deleted from f81689
1 change: 0 additions & 1 deletion buildbot
Submodule buildbot deleted from 3a4761
6 changes: 0 additions & 6 deletions conf/karma.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,6 @@ files = [
'conf/mocha.conf.js',
'node_modules/chai/chai.js',
'test/js/*.js',
{pattern: 'CustomElements/**/*', included: false},
{pattern: 'HTMLImports/**/*', included: false},
// {pattern: 'MDV/**/*', included: false},
// {pattern: 'PointerGestures/**/*', included: false},
// {pattern: 'ShadowDOM/**/*', included: false},
// {pattern: 'WebAnimations/**/*', included: false},
{pattern: 'tools/**/*.js', included: false},
{pattern: 'platform.*', included: false},
{pattern: 'test/**/*.html', included: false},
Expand Down
43 changes: 27 additions & 16 deletions gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
*/
module.exports = function(grunt) {
ShadowDOMNative = [
'CustomElements/src/sidetable.js',
'../CustomElements/src/sidetable.js',
'lib/patches-shadowdom-native.js'
];

Expand Down Expand Up @@ -33,7 +33,7 @@ module.exports = function(grunt) {
'wrappers/override-constructors.js'
];
ShadowDOMPolyfill = ShadowDOMPolyfill.map(function(p) {
return 'ShadowDOM/src/' + p;
return '../ShadowDOM/src/' + p;
});
ShadowDOMPolyfill.push(
'lib/patches-shadowdom-polyfill.js'
Expand All @@ -47,9 +47,15 @@ module.exports = function(grunt) {
];

MDV = [
'MDV/third_party/ChangeSummary/change_summary.js',
'MDV/src/template_element.js'
'third_party/ChangeSummary/change_summary.js',
'src/template_element.js',
'third_party/esprima/esprima.js',
'util/expression_syntax.js'
];
MDV = MDV.map(function(p) {
return '../mdv/' + p;
});

MDV.push(
'lib/patches-mdv.js'
);
Expand All @@ -62,11 +68,14 @@ module.exports = function(grunt) {
'sidetable.js',
'dispatcher.js',
'installer.js',
'mouse.js',
'touch.js',
'ms.js',
'platform-events.js',
'capture.js',
];
PointerEvents = PointerEvents.map(function(p) {
return 'PointerGestures/src/PointerEvents/src/' + p;
return '../PointerEvents/src/' + p;
});

PointerGestures = [
Expand All @@ -81,21 +90,23 @@ module.exports = function(grunt) {
'tap.js'
];
PointerGestures = PointerGestures.map(function(p) {
return 'PointerGestures/src/' + p;
return '../PointerGestures/src/' + p;
});

HTMLImports = [
'HTMLImports/src/HTMLImports.js'
'../HTMLImports/src/HTMLImports.js',
'../HTMLImports/src/Parser.js',
'../HTMLImports/src/boot.js'
];

CustomElements = [
'CustomElements/MutationObservers/MutationObserver.js',
'CustomElements/src/MutationObserver.js',
'CustomElements/src/CustomElements.js',
'CustomElements/src/Observer.js',
'CustomElements/src/HTMLElementElement.js',
'CustomElements/src/Parser.js',
'CustomElements/src/boot.js',
'../CustomElements/MutationObservers/MutationObserver.js',
'../CustomElements/src/MutationObserver.js',
'../CustomElements/src/CustomElements.js',
'../CustomElements/src/Observer.js',
'../CustomElements/src/HTMLElementElement.js',
'../CustomElements/src/Parser.js',
'../CustomElements/src/boot.js',
'lib/patches-custom-elements.js'
];

Expand Down Expand Up @@ -136,7 +147,6 @@ module.exports = function(grunt) {
PointerEvents,
PointerGestures
);


// karma setup
var browsers;
Expand Down Expand Up @@ -182,7 +192,8 @@ module.exports = function(grunt) {
},
uglify: {
options: {
banner: '/* Copyright 2013 The Polymer Authors. All rights reserved. Use of this source code is governed by a BSD-style license that can be found in the LICENSE file. */\n'
banner: grunt.file.read('LICENSE'),
nonull: true
},
Platform: {
options: {
Expand Down
38 changes: 35 additions & 3 deletions lib/lang.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,40 @@ if (!Function.prototype.bind) {
};
}

// namespace an import from CustomElements
// TODO(sjmiles): clean up this global
scope.mixin = window.mixin;
// mixin

// copy all properties from inProps (et al) to inObj
function mixin(inObj/*, inProps, inMoreProps, ...*/) {
var obj = inObj || {};
for (var i = 1; i < arguments.length; i++) {
var p = arguments[i];
try {
for (var n in p) {
copyProperty(n, p, obj);
}
} catch(x) {
}
}
return obj;
}

// copy property inName from inSource object to inTarget object
function copyProperty(inName, inSource, inTarget) {
var pd = getPropertyDescriptor(inSource, inName);
Object.defineProperty(inTarget, inName, pd);
}

// get property descriptor for inName on inObject, even if
// inName exists on some link in inObject's prototype chain
function getPropertyDescriptor(inObject, inName) {
if (inObject) {
var pd = Object.getOwnPropertyDescriptor(inObject, inName);
return pd || getPropertyDescriptor(Object.getPrototypeOf(inObject), inName);
}
}

// export

scope.mixin = mixin;

})(window.Platform);
6 changes: 5 additions & 1 deletion lib/patches-mdv.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,11 @@ window.addEventListener('WebComponentsReady', function() {
dirtyCheck();
//console.profileEnd();
//}, 0);
setInterval(check, dirtyCheckPollInterval);

// dirty check periodically if platform does not have object observe.
if (!Observer.hasObjectObserve) {
setInterval(check, dirtyCheckPollInterval);
}
});

// exports
Expand Down
15 changes: 12 additions & 3 deletions lib/patches-shadowdom-native.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,18 @@
return n;
}

window.createShadowRoot = function(inElement) {
return inElement.webkitCreateShadowRoot();
};
Object.defineProperties(HTMLElement.prototype, {
shadowRoot: {
get: function() {
return this.webkitShadowRoot;
}
},
createShadowRoot: {
value: function() {
return this.webkitCreateShadowRoot();
}
}
});

window.templateContent = function(inTemplate) {
// if MDV exists, it may need to boostrap this template to reveal content
Expand Down
10 changes: 5 additions & 5 deletions platform.debug.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ var ShadowDOMNative = [
];

var ShadowDOMPolyfill = [
'ShadowDOM/shadowdom.js',
'../ShadowDOM/shadowdom.js',
'lib/patches-shadowdom-polyfill.js'
];

Expand All @@ -35,17 +35,17 @@ var Lib = [
];

var MDV = [
'MDV/mdv.js',
'../mdv/mdv.js',
'lib/patches-mdv.js'
];

var Pointer = [
'PointerGestures/src/pointergestures.js'
'../PointerGestures/pointergestures.js'
];

var WebElements = [
'HTMLImports/html-imports.js',
'CustomElements/custom-elements.js',
'../HTMLImports/html-imports.js',
'../CustomElements/custom-elements.js',
'lib/patches-custom-elements.js'
];

Expand Down
36 changes: 31 additions & 5 deletions platform.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion platform.min.js.map

Large diffs are not rendered by default.

34 changes: 30 additions & 4 deletions platform.native.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion platform.native.min.js.map

Large diffs are not rendered by default.

36 changes: 31 additions & 5 deletions platform.sandbox.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion platform.sandbox.min.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion test/html/includes/strawkit.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Polymer = {
inPrototype.readyCallback = function() {
var template = inElement.querySelector('template');
if (template) {
var root = this.webkitCreateShadowRoot();
var root = this.createShadowRoot();
root.appendChild(templateContent(template).cloneNode(true));
}
inPrototype.created.call(this);
Expand Down
47 changes: 47 additions & 0 deletions test/html/mdv-shadow.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
<!DOCTYPE html>
<!--
Copyright 2013 The Polymer Authors. All rights reserved.
Use of this source code is governed by a BSD-style
license that can be found in the LICENSE file.
-->
<html lang="en">
<head>
<meta charset="UTF-8">
<title>MDV + ShadowDOM Polyfill Integration Tests</title>
<link rel="stylesheet" href="../../node_modules/mocha/mocha.css">
<script src="../../../ShadowDOM/shadowdom.js"></script>
<script src="../../node_modules/mocha/mocha.js"></script>
<script src="../../node_modules/chai/chai.js"></script>
<script src="../../tools/test/htmltest.js"></script>
<script src="../../../mdv/tests/setup.js"></script>
<script src="../../../mdv/mdv.js"></script>
</head>
<body>
<script>

mocha.setup({
ignoreLeaks: true,
ui: 'tdd'
});

var assert = chai.assert;

</script>
<!-- <script src="../../../mdv/tests/node_bindings.js"></script> -->
<script src="../../../mdv/tests/template_element.js"></script>
<script src="../../../mdv/tests/expression_syntax.js"></script>
<div id="mocha"></div>
<script>
var unwrap = ShadowDOMPolyfill.unwrap;
// mocha stomps window.onerror, save for failure case
var htmlsuite_fail = window.onerror;
var runner = mocha.run();
runner.on('fail', function(test, err) {
htmlsuite_fail(err.toString());
});
runner.on('end', function() {
runner.failures || done();
});
</script>
</body>
</html>
2 changes: 1 addition & 1 deletion test/html/smoke.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<meta charset="UTF-8">
<script src="../../tools/test/htmltest.js"></script>
<script src="../../node_modules/chai/chai.js"></script>
<script src="../../platform.js"></script>
<script src="../../platform.js" debug></script>
</head>
<body>
<x-foo>plain</x-foo>
Expand Down
3 changes: 2 additions & 1 deletion test/html/strawkit.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<script src="../../tools/test/htmltest.js"></script>
<script src="../../node_modules/chai/chai.js"></script>
<!-- -->
<script src="../../platform.js"></script>
<script src="../../platform.js" debug></script>
<script src="includes/strawkit.js"></script>
</head>
<body>
Expand Down Expand Up @@ -40,6 +40,7 @@
'x-foo has wrong textContent');
assert.match(elt.style.backgroundColor, /lightblue|rgb\(173, 216, 230\)/,
'x-foo has wrong backgroundColor');
assert.ok(elt.shadowRoot, 'shadowRoot not available as `.shadowRoot`');
done();
});
</script>
Expand Down
2 changes: 1 addition & 1 deletion test/html/template-distribute.html
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@

function createShadowRoot(node) {
return window.ShadowDOMPolyfill ? node.createShadowRoot() :
node.webkitCreateShadowRoot();
node.createShadowRoot();
}

document.addEventListener('DOMContentLoaded', function() {
Expand Down
3 changes: 1 addition & 2 deletions test/html/web-components.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@
<meta charset="UTF-8">
<script src="../../tools/test/htmltest.js"></script>
<script src="../../node_modules/chai/chai.js"></script>
<script src="../../HTMLImports/html-imports.js"></script>
<script src="../../CustomElements/custom-elements.js"></script>
<script src="../../platform.js" debug></script>
<link rel="import" href="includes/import-file.html">
</head>
<body>
Expand Down
3 changes: 2 additions & 1 deletion test/js/tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,5 @@ htmlSuite('integration', function() {
htmlTest('html/smoke.html?shadow=polyfill');
htmlTest('html/strawkit.html');
htmlTest('html/strawkit.html?shadow=polyfill');
});
htmlTest('html/mdv-shadow.html');
});
Loading

0 comments on commit 35c5280

Please sign in to comment.