-
Notifications
You must be signed in to change notification settings - Fork 3.9k
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
Coreify specific layout.js, CE, and BE functions #34810
Changes from 3 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
/** | ||
* Copyright 2015 The AMP HTML Authors. All Rights Reserved. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS-IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
import {devAssertElement} from './assert'; | ||
|
||
/** | ||
* Returns "true" for internal AMP nodes or for placeholder elements. | ||
* @param {!Node} node | ||
* @return {boolean} | ||
*/ | ||
export function isInternalOrServiceNode(node) { | ||
if (node.nodeType !== Node.ELEMENT_NODE) { | ||
return false; | ||
} | ||
node = devAssertElement(node); | ||
|
||
if (node.tagName.toLowerCase().startsWith('i-')) { | ||
return true; | ||
} | ||
if ( | ||
node.hasAttribute('placeholder') || | ||
node.hasAttribute('fallback') || | ||
node.hasAttribute('overflow') | ||
) { | ||
return true; | ||
} | ||
return false; | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nice! More core! I think it would make sense for this whole file to live in There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes! But that requires changing 100s of files import paths and so I'd rather do it separately since my main goal is to unblock #34770 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If I understand correctly, this is only used in custom-element. What's the motivation for moving it into core, rather than closer to CE? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Created #34818 to unblock any dependencies on There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Compiler will need to run it, and we don't want compiler to need an instance of There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe just a helper in |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would it make sense for
applyFillContent
to be defined locally in this file?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Still relevant, since we don't really want other code using this instead of
element.applyFillContent
. Including it incore
kinda implies it's fine, whereas no one will go out of their way to import it from here (except the compiler)There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, I'm fine with that