Re: [csswg-drafts] [css-selectors] :stuck pseudo-class feature suggestion

After much pondering, I now get why it was not implemented:

1. Circular selection issue - breaks the website function and user experience, that's a big No No. We can maybe leave that out for developers to figure out the circular issue, but then, it becomes "buggy".

2. Performance consideration - we can prevent circular selection issue by implementing logic, that might be checking each class & id's if there are combinations that cause circular selection. 

In programming, Boolean evaluation are very expensive vs not evaluating at all. It certain websites, there maybe hundreds or worst thousands of these elements, so this implementation could go exponentially in terms of compute resource. Doing the same thing in JS would then become faster for that 1 div we want "stuck" pseudo class for.

**Suggested solution 1 so that we can address point 2**

1. Implement :stuck pseudo class without logic, then implement a css developer checker within css engine so whenever the devs. are in inspect mode, they get notified about this issue. When not in dev mode this check is disabled so we avoid issue #2.

**Suggested solution 2 so that we can address both point 1 & 2**

1. Implement the `:stuck` pseudo class like a `function` so when the css parser encounters `:stuck` it calls its function then carry out evaluations, if there is a circular selection drop that css block then continue parsing the css.

It goes like this

`:stuck --parser--> function stuck(){//drop if circular selection}`

In this implementation, we avoid evaluating each and every element since the "checkers" is only asked to evaluate for `:stuck` class only.

I think the last suggestion is really sensible enough to enable great features without the dreaded performance problem. Can we reopen this ticket for implementations?

-- 
GitHub Notification of comment by jobs-git
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/1656#issuecomment-389552199 using your GitHub account

Received on Wednesday, 16 May 2018 15:04:36 UTC