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

Commit 69f4e98

Browse files
committed
Merge pull request #49 from Polymer/master
7/11 master -> stable
2 parents 849adf7 + ac5a5ab commit 69f4e98

8 files changed

Lines changed: 104 additions & 105 deletions

File tree

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/node_modules
2-
2+
npm-debug.log
33
/custom-elements.min.js
44
/custom-elements.min.source-map.js
55
/docs

build.json

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
[
2+
"src/sidetable.js",
3+
"MutationObservers/MutationObserver.js",
4+
"src/CustomElements.js",
5+
"src/MutationObserver.js",
6+
"src/Observer.js",
7+
"src/HTMLElementElement.js",
8+
"src/Parser.js",
9+
"src/boot.js"
10+
]

conf/karma.conf.js

Lines changed: 79 additions & 85 deletions
Original file line numberDiff line numberDiff line change
@@ -1,86 +1,80 @@
1-
// Sample Karma configuration file, that contain pretty much all the available options
2-
// It's used for running client tests on Travis (http://travis-ci.org/#!/karma-runner/karma)
3-
// Most of the options can be overriden by cli arguments (see karma --help)
4-
//
5-
// For all available config options and default values, see:
6-
// https://github.com/karma-runner/karma/blob/stable/lib/config.js#L54
7-
8-
9-
// base path, that will be used to resolve files and exclude
10-
basePath = '../';
11-
12-
// list of files / patterns to load in the browser
13-
files = [
14-
'conf/mocha.conf.js',
15-
'node_modules/chai/chai.js',
16-
'test/*.js',
17-
'custom-elements.js',
18-
{pattern: 'src/*', included: false},
19-
{pattern: 'tools/**/*.js', included: false}
20-
];
21-
22-
// list of files to exclude
23-
exclude = [];
24-
25-
frameworks = ['mocha'];
26-
27-
// use dots reporter, as travis terminal does not support escaping sequences
28-
// possible values: 'dots', 'progress', 'junit', 'teamcity'
29-
// CLI --reporters progress
30-
reporters = ['progress'];
31-
32-
// web server port
33-
// CLI --port 9876
34-
port = 9876;
35-
36-
// cli runner port
37-
// CLI --runner-port 9100
38-
runnerPort = 9100;
39-
40-
// enable / disable colors in the output (reporters and logs)
41-
// CLI --colors --no-colors
42-
colors = true;
43-
44-
// level of logging
45-
// possible values: LOG_DISABLE || LOG_ERROR || LOG_WARN || LOG_INFO || LOG_DEBUG
46-
// CLI --log-level debug
47-
logLevel = LOG_INFO;
48-
49-
// enable / disable watching file and executing tests whenever any file changes
50-
// CLI --auto-watch --no-auto-watch
51-
autoWatch = true;
52-
53-
// Start these browsers, currently available:
54-
// - Chrome
55-
// - ChromeCanary
56-
// - Firefox
57-
// - Opera
58-
// - Safari (only Mac)
59-
// - PhantomJS
60-
// - IE (only Windows)
61-
// CLI --browsers Chrome,Firefox,Safari
62-
browsers = ['ChromeCanary'];
63-
64-
// If browser does not capture in given timeout [ms], kill it
65-
// CLI --capture-timeout 5000
66-
captureTimeout = 50000;
67-
68-
// Auto run tests on start (when browsers are captured) and exit
69-
// CLI --single-run --no-single-run
70-
singleRun = true;
71-
72-
// report which specs are slower than 500ms
73-
// CLI --report-slower-than 500
74-
reportSlowerThan = 500;
75-
76-
// compile coffee scripts
77-
preprocessors = {
1+
module.exports = function(karma) {
2+
karma.configure({
3+
// base path, that will be used to resolve files and exclude
4+
basePath: '../',
5+
6+
// list of files / patterns to load in the browser
7+
files: [
8+
'tools/test/mocha-htmltest.js',
9+
'conf/mocha.conf.js',
10+
'node_modules/chai/chai.js',
11+
'custom-elements.js',
12+
'test/js/*.js',
13+
{pattern: 'src/*', included: false},
14+
{pattern: 'test/html/*.html', included: false},
15+
{pattern: 'tools/**/*.js', included: false}
16+
],
17+
18+
// list of files to exclude
19+
exclude: [],
20+
21+
frameworks: ['mocha'],
22+
23+
// use dots reporter, as travis terminal does not support escaping sequences
24+
// possible values: 'dots', 'progress', 'junit', 'teamcity'
25+
// CLI --reporters progress
26+
reporters: ['progress'],
27+
28+
// web server port
29+
// CLI --port 9876
30+
port: 9876,
31+
32+
// cli runner port
33+
// CLI --runner-port 9100
34+
runnerPort: 9100,
35+
36+
// enable / disable colors in the output (reporters and logs)
37+
// CLI --colors --no-colors
38+
colors: true,
39+
40+
// level of logging
41+
// possible values: LOG_DISABLE || LOG_ERROR || LOG_WARN || LOG_INFO || LOG_DEBUG
42+
// CLI --log-level debug
43+
logLevel: karma.LOG_INFO,
44+
45+
// enable / disable watching file and executing tests whenever any file changes
46+
// CLI --auto-watch --no-auto-watch
47+
autoWatch: true,
48+
49+
// Start these browsers, currently available:
50+
// - Chrome
51+
// - ChromeCanary
52+
// - Firefox
53+
// - Opera
54+
// - Safari (only Mac)
55+
// - PhantomJS
56+
// - IE (only Windows)
57+
// CLI --browsers Chrome,Firefox,Safari
58+
browsers: ['ChromeCanary'],
59+
60+
// If browser does not capture in given timeout [ms], kill it
61+
// CLI --capture-timeout 5000
62+
captureTimeout: 50000,
63+
64+
// Auto run tests on start (when browsers are captured) and exit
65+
// CLI --single-run --no-single-run
66+
singleRun: true,
67+
68+
// report which specs are slower than 500ms
69+
// CLI --report-slower-than 500
70+
reportSlowerThan: 500,
71+
72+
plugins: [
73+
'karma-mocha',
74+
'karma-chrome-launcher',
75+
'karma-firefox-launcher',
76+
'karma-script-launcher',
77+
'karma-crbot-reporter'
78+
]
79+
});
7880
};
79-
80-
plugins = [
81-
'karma-mocha',
82-
'karma-chrome-launcher',
83-
'karma-firefox-launcher',
84-
'karma-script-launcher',
85-
'karma-crbot-reporter'
86-
]

conf/mocha.conf.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,4 @@
1-
mocha.setup({ui:'tdd'});
1+
mocha.setup({
2+
ui:'tdd',
3+
htmlbase: '/base/test/'
4+
});

gruntfile.js

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,7 @@ module.exports = function(grunt) {
1212
if (os.type() === 'Windows_NT') {
1313
browsers.push('IE');
1414
}
15-
CustomElements = [
16-
'src/sidetable.js',
17-
'MutationObservers/MutationObserver.js',
18-
'src/CustomElements.js',
19-
'src/HTMLElementElement.js',
20-
'src/Parser.js',
21-
'src/boot.js'
22-
];
15+
CustomElements = grunt.file.readJSON('build.json');
2316
// karma setup
2417
var browsers;
2518
(function() {
@@ -58,11 +51,10 @@ module.exports = function(grunt) {
5851
},
5952
uglify: {
6053
CustomElements: {
61-
/*
6254
options: {
63-
sourceMap: 'custom-elements.min.source-map.js'
55+
// sourceMap: 'custom-elements.min.source-map.js'
56+
banner: grunt.file.read('LICENSE')
6457
},
65-
*/
6658
files: {
6759
'custom-elements.min.js': CustomElements
6860
}
@@ -90,7 +82,7 @@ module.exports = function(grunt) {
9082
// plugins
9183
grunt.loadNpmTasks('grunt-contrib-uglify');
9284
grunt.loadNpmTasks('grunt-contrib-yuidoc');
93-
grunt.loadNpmTasks('grunt-karma-0.9.1');
85+
grunt.loadNpmTasks('grunt-karma');
9486

9587
// tasks
9688
grunt.registerTask('default', ['uglify']);

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
"grunt": "*",
99
"grunt-contrib-uglify": "*",
1010
"grunt-contrib-yuidoc": "~0.4.0",
11-
"grunt-karma-0.9.1": "~0.4.3",
11+
"grunt-karma": "~0.5.0",
1212
"karma-mocha": "*",
1313
"karma-script-launcher": "*",
1414
"karma-crbot-reporter": "*"

src/HTMLElementElement.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
*/
66

77
(function(){
8-
8+
99
var HTMLElementElement = function(inElement) {
1010
inElement.register = HTMLElementElement.prototype.register;
1111
parseElementElement(inElement);
@@ -49,7 +49,7 @@ function parseElementElement(inElement) {
4949
// install options
5050
inElement.options = options;
5151
// locate user script
52-
var script = inElement.querySelector('script,scripts');
52+
var script = inElement.querySelector('script:not([type]),script[type="text/javascript"],scripts');
5353
if (script) {
5454
// execute user script in 'inElement' context
5555
executeComponentScript(script.textContent, inElement, options.name);
@@ -63,7 +63,7 @@ function parseElementElement(inElement) {
6363
window[refName] = ctor;
6464
}
6565
}
66-
66+
6767
// each property in inDictionary takes a value
6868
// from the matching attribute in inElement, if any
6969
function takeAttributes(inElement, inDictionary) {
@@ -81,7 +81,7 @@ function executeComponentScript(inScript, inContext, inName) {
8181
context = inContext;
8282
// source location
8383
var owner = context.ownerDocument;
84-
var url = (owner._URL || owner.URL || owner.impl
84+
var url = (owner._URL || owner.URL || owner.impl
8585
&& (owner.impl._URL || owner.impl.URL));
8686
// ensure the component has a unique source map so it can be debugged
8787
// if the name matches the filename part of the owning document's url,

src/boot.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ function bootstrap() {
1818
// synchronous upgrades
1919
CustomElements.ready = true;
2020
// capture blunt profiling data
21-
CustomElements.readyTime = new Date().getTime();
21+
CustomElements.readyTime = Date.now();
2222
if (window.HTMLImports) {
2323
CustomElements.elapsed = CustomElements.readyTime - HTMLImports.readyTime;
2424
}

0 commit comments

Comments
 (0)