(parser)
| 790 | } |
| 791 | |
| 792 | static parse(parser) { |
| 793 | if (!parser.matchToken("scroll")) return; |
| 794 | |
| 795 | // scroll to ... form |
| 796 | if (parser.matchToken("to")) { |
| 797 | var scroll = _parseScrollModifiers(parser); |
| 798 | return new ScrollCommand(scroll.target, scroll.offset, scroll.plusOrMinus, scroll.scrollOptions, scroll.container); |
| 799 | } |
| 800 | |
| 801 | // scroll [<target>] [up|down|left|right] by <amount>px [smoothly|instantly] |
| 802 | var direction = parser.matchAnyToken("up", "down", "left", "right"); |
| 803 | var target; |
| 804 | |
| 805 | if (!direction && parser.currentToken().value !== "by") { |
| 806 | target = parser.requireElement("unaryExpression"); |
| 807 | direction = parser.matchAnyToken("up", "down", "left", "right"); |
| 808 | } |
| 809 | |
| 810 | parser.requireToken("by"); |
| 811 | |
| 812 | parser.pushFollow("px"); |
| 813 | var offset; |
| 814 | try { |
| 815 | offset = parser.requireElement("expression"); |
| 816 | } finally { |
| 817 | parser.popFollow(); |
| 818 | } |
| 819 | parser.matchToken("px"); |
| 820 | |
| 821 | var behavior = _parseSmoothness(parser); |
| 822 | var scrollOptions = {}; |
| 823 | if (behavior) scrollOptions.behavior = behavior; |
| 824 | |
| 825 | var byMode = { direction: direction ? direction.value : "down" }; |
| 826 | return new ScrollCommand(target, offset, null, scrollOptions, null, byMode); |
| 827 | } |
| 828 | |
| 829 | resolve(ctx, { target, offset, container }) { |
| 830 | if (this.byMode) { |
nothing calls this directly
no test coverage detected