Skip to content

fix: add escape to CSS #370

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from

Conversation

alan-agius4
Copy link
Contributor

@@ -1819,6 +1819,7 @@ declare var CryptoKeyPair: {
};

interface CSS {
escape(value?: string): string;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

to be honest I am not sure 100% that the value should be a string as while the input is a DOMString from the example it seems that It can accept a number.
Example

CSS.escape(".foo#bar")        // "\.foo\#bar"
CSS.escape("()[]{}")          // "\(\)\[\]\{\}"
CSS.escape('--a')             // "--a"
CSS.escape(0)                 // "\30 ", the Unicode code point of '0' is 30
CSS.escape('\0')              // "\ufffd", the Unicode REPLACEMENT CHARACTER

@mhegazy
Copy link
Contributor

mhegazy commented Feb 12, 2018

The file is automatically generated. please make your edits in https://github.com/Microsoft/TSJS-lib-generator/blob/master/inputfiles/overridingTypes.json instead.
See https://github.com/Microsoft/TSJS-lib-generator#contribution-guidelines for more details.

@mhegazy mhegazy closed this Feb 12, 2018
@alan-agius4 alan-agius4 deleted the feature/css-escape branch February 12, 2018 17:13
@alan-agius4
Copy link
Contributor Author

alan-agius4 commented Feb 12, 2018

@mhegazy

Question: I noticed that the CSS.escape is a WD (https://developer.mozilla.org/en-US/docs/Web/API/CSS/escape) and based on https://github.com/Microsoft/TSJS-lib-generator#contribution-guidelines. It shouldn't be added here either correct?

@mhegazy
Copy link
Contributor

mhegazy commented Feb 12, 2018

We have been accepting these lately.

@alan-agius4
Copy link
Contributor Author

alan-agius4 commented Feb 12, 2018

I think you the new method should go in addedTypes.json rather than overridingTypes.json as this method is not yet declared.

However, when I do so I end up with something like this;

interface CSS {
    escape(value: string): string;
}

declare var CSS: {
    supports(property: string, value?: string): boolean;
};

Maybe you can point me to the right direction?

@mhegazy
Copy link
Contributor

mhegazy commented Feb 12, 2018

yes. you are correct, addedTypes is the right place.

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.

2 participants