Skip to content

Commit f8a21b8

Browse files
committed
fixup! Implement [LegacyFactoryFunction]
1 parent ee7f6ef commit f8a21b8

File tree

3 files changed

+176
-166
lines changed

3 files changed

+176
-166
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -282,7 +282,7 @@ Creates a new instance of the wrapper class and corresponding implementation cla
282282

283283
This is useful inside implementation class files, where it is easiest to only deal with impls, not wrappers.
284284

285-
#### `new(globalObject [ , newTarget ])`
285+
#### `new(globalObject, newTarget)`
286286

287287
Creates a new instance of the wrapper class and corresponding implementation class, but without invoking the implementation class constructor logic. Then returns the implementation class.
288288

lib/constructs/interface.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ class LegacyFactoryFunction {
8282
// the return type, which is used by HTML's element legacy factory functions:
8383
str += `
8484
const thisArgument = exports.new(globalObject, new.target);
85-
const result = Impl.legacyFactoryFunction.call(thisArg, ${formatArgs(setupArgs)});
85+
const result = Impl.legacyFactoryFunction.call(thisArgument, ${formatArgs(setupArgs)});
8686
return utils.tryWrapperForImpl(utils.isObject(result) ? result : thisArgument);
8787
`;
8888

@@ -1206,7 +1206,7 @@ class Interface {
12061206

12071207
generateIface() {
12081208
this.str += `
1209-
function makeWrapper(globalObject, newTarget = undefined) {
1209+
function makeWrapper(globalObject, newTarget) {
12101210
if (globalObject[ctorRegistrySymbol] === undefined) {
12111211
throw new Error('Internal error: invalid global object');
12121212
}
@@ -1292,7 +1292,7 @@ class Interface {
12921292
return wrapper;
12931293
};
12941294
1295-
exports.new = (globalObject, newTarget = undefined) => {
1295+
exports.new = (globalObject, newTarget) => {
12961296
${this.isLegacyPlatformObj ? "let" : "const"} wrapper = makeWrapper(globalObject, newTarget);
12971297
12981298
exports._internalSetup(wrapper, globalObject);

0 commit comments

Comments
 (0)