* Whether the loading can be shown for this element. * @param {boolean} force * @return {boolean} * @private
(force)
| 2016 | * @private |
| 2017 | */ |
| 2018 | isLoadingEnabled_(force) { |
| 2019 | // No loading indicator will be shown if either one of these conditions |
| 2020 | // true: |
| 2021 | // 1. The document is A4A. |
| 2022 | // 2. `noloading` attribute is specified; |
| 2023 | // 3. The element has already been laid out, and does not support reshowing the indicator (include having loading |
| 2024 | // error); |
| 2025 | // 4. The element is too small or has not yet been measured; |
| 2026 | // 5. The element has not been allowlisted; |
| 2027 | // 6. The element is an internal node (e.g. `placeholder` or `fallback`); |
| 2028 | // 7. The element's layout is not nodisplay. |
| 2029 | |
| 2030 | const laidOut = |
| 2031 | this.layoutCount_ > 0 || |
| 2032 | this.signals_.get(CommonSignals_Enum.RENDER_START); |
| 2033 | if ( |
| 2034 | this.layout_ == Layout_Enum.NODISPLAY || |
| 2035 | this.hasAttribute('noloading') || |
| 2036 | (laidOut && !force) || |
| 2037 | !isLoadingAllowed(this) || |
| 2038 | query.isInternalOrServiceNode(this) |
| 2039 | ) { |
| 2040 | return false; |
| 2041 | } |
| 2042 | |
| 2043 | return true; |
| 2044 | } |
| 2045 | |
| 2046 | /** |
| 2047 | * Turns the loading indicator on or off. |
no test coverage detected