(parser)
| 8855 | } |
| 8856 | } |
| 8857 | static parse(parser) { |
| 8858 | if (!parser.matchToken("on")) return; |
| 8859 | var every = false; |
| 8860 | var first = false; |
| 8861 | if (parser.matchToken("every")) { |
| 8862 | every = true; |
| 8863 | } else if (parser.matchToken("first")) { |
| 8864 | first = true; |
| 8865 | } |
| 8866 | var events = []; |
| 8867 | var displayName = null; |
| 8868 | do { |
| 8869 | var on = parser.requireElement("eventName", "Expected event name"); |
| 8870 | var eventName = on.evalStatically(); |
| 8871 | if (displayName) { |
| 8872 | displayName = displayName + " or " + eventName; |
| 8873 | } else { |
| 8874 | displayName = "on " + eventName; |
| 8875 | } |
| 8876 | var args = ParseElement.parseEventArgs(parser); |
| 8877 | var filter = null; |
| 8878 | if (parser.matchOpToken("[")) { |
| 8879 | filter = parser.requireElement("expression"); |
| 8880 | parser.requireOpToken("]"); |
| 8881 | } |
| 8882 | var startCount, endCount, unbounded; |
| 8883 | if (first) { |
| 8884 | startCount = 1; |
| 8885 | } else if (parser.currentToken().type === "NUMBER") { |
| 8886 | var startCountToken = parser.consumeToken(); |
| 8887 | if (!startCountToken.value) return; |
| 8888 | startCount = parseInt(startCountToken.value); |
| 8889 | if (parser.matchToken("to")) { |
| 8890 | var endCountToken = parser.consumeToken(); |
| 8891 | if (!endCountToken.value) return; |
| 8892 | endCount = parseInt(endCountToken.value); |
| 8893 | } else if (parser.matchToken("and")) { |
| 8894 | unbounded = true; |
| 8895 | parser.requireToken("on"); |
| 8896 | } |
| 8897 | } |
| 8898 | var intersectionSpec, mutationSpec, resizeSpec; |
| 8899 | if (eventName === "resize") { |
| 8900 | resizeSpec = true; |
| 8901 | } else if (eventName === "intersection") { |
| 8902 | intersectionSpec = {}; |
| 8903 | if (parser.matchToken("with")) { |
| 8904 | intersectionSpec["with"] = parser.requireElement("expression").evalStatically(); |
| 8905 | } |
| 8906 | if (parser.matchToken("having")) { |
| 8907 | do { |
| 8908 | if (parser.matchToken("margin")) { |
| 8909 | intersectionSpec["rootMargin"] = parser.requireElement("stringLike").evalStatically(); |
| 8910 | } else if (parser.matchToken("threshold")) { |
| 8911 | intersectionSpec["threshold"] = parser.requireElement("expression").evalStatically(); |
| 8912 | } else { |
| 8913 | parser.raiseError("Unknown intersection config specification"); |
| 8914 | } |
nothing calls this directly
no test coverage detected