This repository has been archived by the owner on Mar 13, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 49
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #202 from Polymer/master
8/8 master -> stable
- Loading branch information
Showing
24 changed files
with
725 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
// Copyright 2013 The Polymer Authors. All rights reserved. | ||
// Use of this source code is goverened by a BSD-style | ||
// license that can be found in the LICENSE file. | ||
|
||
(function(scope) { | ||
'use strict'; | ||
|
||
var registerWrapper = scope.registerWrapper; | ||
var unwrap = scope.unwrap; | ||
var unwrapIfNeeded = scope.unwrapIfNeeded; | ||
var wrap = scope.wrap; | ||
|
||
function Range(impl) { | ||
this.impl = impl; | ||
} | ||
Range.prototype = { | ||
get startContainer() { | ||
return wrap(this.impl.startContainer); | ||
}, | ||
get endContainer() { | ||
return wrap(this.impl.endContainer); | ||
}, | ||
get commonAncestorContainer() { | ||
return wrap(this.impl.commonAncestorContainer); | ||
}, | ||
setStart: function(refNode,offset) { | ||
this.impl.setStart(unwrapIfNeeded(refNode), offset); | ||
}, | ||
setEnd: function(refNode,offset) { | ||
this.impl.setEnd(unwrapIfNeeded(refNode), offset); | ||
}, | ||
setStartBefore: function(refNode) { | ||
this.impl.setStartBefore(unwrapIfNeeded(refNode)); | ||
}, | ||
setStartAfter: function(refNode) { | ||
this.impl.setStartAfter(unwrapIfNeeded(refNode)); | ||
}, | ||
setEndBefore: function(refNode) { | ||
this.impl.setEndBefore(unwrapIfNeeded(refNode)); | ||
}, | ||
setEndAfter: function(refNode) { | ||
this.impl.setEndAfter(unwrapIfNeeded(refNode)); | ||
}, | ||
selectNode: function(refNode) { | ||
this.impl.selectNode(unwrapIfNeeded(refNode)); | ||
}, | ||
selectNodeContents: function(refNode) { | ||
this.impl.selectNodeContents(unwrapIfNeeded(refNode)); | ||
}, | ||
compareBoundaryPoints: function(how, sourceRange) { | ||
return this.impl.compareBoundaryPoints(how, unwrap(sourceRange)); | ||
}, | ||
extractContents: function() { | ||
return wrap(this.impl.extractContents()); | ||
}, | ||
cloneContents: function() { | ||
return wrap(this.impl.cloneContents()); | ||
}, | ||
insertNode: function(node) { | ||
this.impl.insertNode(unwrapIfNeeded(node)); | ||
}, | ||
surroundContents: function(newParent) { | ||
this.impl.surroundContents(unwrapIfNeeded(newParent)); | ||
}, | ||
cloneRange: function() { | ||
return wrap(this.impl.cloneRange()); | ||
}, | ||
isPointInRange: function(node, offset) { | ||
return this.impl.isPointInRange(unwrapIfNeeded(node), offset); | ||
}, | ||
comparePoint: function(node, offset) { | ||
return this.impl.comparePoint(unwrapIfNeeded(node), offset); | ||
}, | ||
intersectsNode: function(node) { | ||
return this.impl.intersectsNode(unwrapIfNeeded(node)); | ||
}, | ||
createContextualFragment: function(html) { | ||
return wrap(this.impl.createContextualFragment(html)); | ||
} | ||
}; | ||
|
||
registerWrapper(window.Range, Range); | ||
|
||
scope.wrappers.Range = Range; | ||
|
||
})(this.ShadowDOMPolyfill); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
// Copyright 2013 The Polymer Authors. All rights reserved. | ||
// Use of this source code is goverened by a BSD-style | ||
// license that can be found in the LICENSE file. | ||
|
||
(function(scope) { | ||
'use strict'; | ||
|
||
var HTMLElement = scope.wrappers.HTMLElement; | ||
var assert = scope.assert; | ||
var mixin = scope.mixin; | ||
var registerWrapper = scope.registerWrapper; | ||
var unwrap = scope.unwrap; | ||
var wrap = scope.wrap; | ||
|
||
var elementsWithFormProperty = [ | ||
'HTMLButtonElement', | ||
'HTMLFieldSetElement', | ||
'HTMLInputElement', | ||
'HTMLKeygenElement', | ||
'HTMLLabelElement', | ||
'HTMLLegendElement', | ||
'HTMLObjectElement', | ||
'HTMLOptionElement', | ||
'HTMLOutputElement', | ||
'HTMLSelectElement', | ||
'HTMLTextAreaElement', | ||
]; | ||
|
||
function createWrapperConstructor(name) { | ||
if (!window[name]) | ||
return; | ||
|
||
// Ensure we are not overriding an already existing constructor. | ||
assert(!scope.wrappers[name]); | ||
|
||
var GeneratedWrapper = function(node) { | ||
// At this point all of them extend HTMLElement. | ||
HTMLElement.call(this, node); | ||
} | ||
GeneratedWrapper.prototype = Object.create(HTMLElement.prototype); | ||
mixin(GeneratedWrapper.prototype, { | ||
get form() { | ||
return wrap(unwrap(this).form); | ||
}, | ||
}); | ||
|
||
registerWrapper(window[name], GeneratedWrapper, | ||
document.createElement(name.slice(4, -7))); | ||
scope.wrappers[name] = GeneratedWrapper; | ||
} | ||
|
||
elementsWithFormProperty.forEach(createWrapperConstructor); | ||
|
||
})(this.ShadowDOMPolyfill); |
Oops, something went wrong.