-
-
Notifications
You must be signed in to change notification settings - Fork 70
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Migrate
CSSStyleDeclaration
to WebIDL2JS
Co-authored-by: Timothy Gu <[email protected]>
- Loading branch information
Showing
22 changed files
with
431 additions
and
140 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,8 @@ | ||
node_modules | ||
lib/CSSStyleDeclaration.js | ||
lib/Function.js | ||
lib/VoidFunction.js | ||
lib/implementedProperties.js | ||
lib/properties.js | ||
lib/utils.js | ||
jest.config.js |
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 |
---|---|---|
@@ -1,5 +1,10 @@ | ||
node_modules | ||
npm-debug.log | ||
lib/CSSStyleDeclaration.js | ||
lib/Function.js | ||
lib/VoidFunction.js | ||
lib/implementedProperties.js | ||
lib/properties.js | ||
lib/utils.js | ||
coverage | ||
src/CSSStyleDeclaration-properties.webidl |
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 |
---|---|---|
@@ -1,3 +1,5 @@ | ||
/* | ||
!lib/ | ||
lib/Function.js | ||
lib/VoidFunction.js | ||
!LICENSE |
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 |
---|---|---|
|
@@ -9,7 +9,6 @@ install: | |
- npm install | ||
- npm install -g codecov | ||
node_js: | ||
- "8" | ||
- "10" | ||
- "12" | ||
|
||
|
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,34 @@ | ||
'use strict'; | ||
const webidlWrapper = require('./webidl2js-wrapper.js'); | ||
|
||
const sharedGlobalObject = {}; | ||
webidlWrapper.install(sharedGlobalObject, ['Window']); | ||
|
||
const origCSSStyleDeclaration = sharedGlobalObject.CSSStyleDeclaration; | ||
|
||
/** | ||
* @constructor | ||
* @param {((cssText: string) => void) | null} [onChangeCallback] | ||
* The callback that is invoked whenever a property changes. | ||
*/ | ||
function CSSStyleDeclaration(onChangeCallback = null) { | ||
if (new.target === undefined) { | ||
throw new TypeError("Class constructor CSSStyleDeclaration cannot be invoked without 'new'"); | ||
} | ||
|
||
if (onChangeCallback !== null && typeof onChangeCallback !== 'function') { | ||
throw new TypeError('Failed to construct CSSStyleDeclaration: parameter 1 is not a function'); | ||
} | ||
|
||
return webidlWrapper.create(sharedGlobalObject, undefined, { onChangeCallback }); | ||
} | ||
|
||
sharedGlobalObject.CSSStyleDeclaration = CSSStyleDeclaration; | ||
Object.defineProperty(CSSStyleDeclaration, 'prototype', { | ||
value: origCSSStyleDeclaration.prototype, | ||
writable: false, | ||
}); | ||
CSSStyleDeclaration.prototype.constructor = CSSStyleDeclaration; | ||
Object.setPrototypeOf(CSSStyleDeclaration, Object.getPrototypeOf(origCSSStyleDeclaration)); | ||
|
||
module.exports = CSSStyleDeclaration; |
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
Oops, something went wrong.