A list container delegates clicks. Input: line 1 — JSON array of item objects {"id": string, "cls": string[]}; line 2 — a CSS-ish selector: either .className or #id; line 3 — clicked item id. Print handled if the clicked item matches the selector, else ignored.
Input: three lines.
Output: handled or ignored.
Your program reads from stdin and prints to stdout.
Example 1
Input: [{"id":"a","cls":["item"]},{"id":"b","cls":["item","active"]}] .active b
Output: handled
Hints
A list container delegates clicks. Input: line 1 — JSON array of item objects {"id": string, "cls": string[]}; line 2 — a CSS-ish selector: either .className or #id; line 3 — clicked item id. Print handled if the clicked item matches the selector, else ignored.
Input: three lines.
Output: handled or ignored.
Your program reads from stdin and prints to stdout.
Example 1
Input: [{"id":"a","cls":["item"]},{"id":"b","cls":["item","active"]}] .active b
Output: handled
Hints