Skip to content

Conversation

falsandtru
Copy link
Contributor

@falsandtru
Copy link
Contributor Author

@zhengbli How can I remove declare var History?

@zhengbli
Copy link
Contributor

zhengbli commented Aug 27, 2016

Why do you need to remove the declare var History? We need a constructor for the instanceof operator to work, also according to microsoft/TypeScript#10059 (comment), console.log(History) does print something in Chrome.

@falsandtru
Copy link
Contributor Author

history is defined in the following spec, but History is not.

https://html.spec.whatwg.org/multipage/browsers.html#the-window-object

@zhengbli
Copy link
Contributor

The constructor is indeed defined in major browsers, it is just forbidden to call. For comparability I would suggest just leave it there. @mhegazy thoughts?
capture
capture1

@falsandtru
Copy link
Contributor Author

falsandtru commented Aug 27, 2016

I think History variable should be defined by users because it is not standardized by spec.

}

declare var History: {
prototype: History;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there is a var History i find in most browsers. why was this removed?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The History is the prototype for the type. the constructor can not be called directly, but that is the same as the rest of the HTML*Element classes as well. so we should keep both a type and a value for History. we already have a value history: History on Window and the global object.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay, fixed.

@zhengbli
Copy link
Contributor

👍 Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants