Skip to content
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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

鉁╝mp-experiment: Base functionality for Demo #21734

Merged

Conversation

torch2424
Copy link
Contributor

@torch2424 torch2424 commented Apr 5, 2019

relates to #20225

This implements some base functionality for amp-experiment for an upcoming initial demo. This includes support for some of the attributes type mutations (style with color and background-color, src, and href), as well as characterData mutations 馃槃

Example

Screen Shot 2019-04-04 at 5 42 25 PM

Copy link
Member

@calebcordry calebcordry left a comment

Choose a reason for hiding this comment

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

Awesome job getting this done so fast! Just a couple small things.

return false;
},
src: value => {
return value.match(/^https:\/\//g);
Copy link
Member

Choose a reason for hiding this comment

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

may want to use assertHttpsUrl here and below

export function assertHttpsUrl(

}

// Allow Color
if (value.match(/^color:\s#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/g)) {
Copy link
Member

Choose a reason for hiding this comment

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

Should the space be optional here?

}

// Allow Background color
if (value.match(/^background-color:\s#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/g)) {
Copy link
Member

Choose a reason for hiding this comment

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

Im fine with this for now, but I feel like eventually the property validation should be separated from the value validation.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Totally agree, after our demo, we will probably be moving this to the Validator. If not, I added an note here: #21705 馃槃

Copy link
Contributor

Choose a reason for hiding this comment

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

nit/bikeshedding:

Why did you go with just \s and not \s* after the colon (:)?

And why no whitespace before the colon or before/after the entire value set?

not nit-picking:

Why the /g? shouldn't there be only one background-color? what does the global accomplish or am I misunderstanding it (happens with regexs)

馃榿

@torch2424
Copy link
Contributor Author

@calebcordry Made requested changes / replied to comments 馃槃

@calebcordry
Copy link
Member

馃憤馃憡馃帀

@jeffjose
Copy link
Contributor

jeffjose commented Apr 5, 2019

馃挭 mode!

@torch2424
Copy link
Contributor Author

Thanks @calebcordry @jeffjose 馃槃

Merging...

@torch2424 torch2424 merged commit 3c0847a into ampproject:master Apr 5, 2019
@torch2424 torch2424 deleted the amp-experiment-1.0-attribute-changes branch April 5, 2019 21:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants