douglascrockford/JSLint — pull request #147 by anaran (2013-07-26 01:39:03+00:00)
Title: Add function link_errors_to_source setting caret in source from error.

The function adds a click listener to each error cite which sets caret
in the source textarea and scrolls it into view (only when necessary).

# Implementation Note

Hi Douglas, I have a better understanding of ADSAFE now.

While I was able to use a ``bunch`` for setting up the click handlers for ``citeErrorBunch``, I am sure now that ADSAFE will not allow me to set the caret in the textarea.

Therefor I have to break the ADSAFE abstraction in one documented place below:

+ // TODO Please note ADSAFE does not provide access to
+ // methods needed for setting caret in textarea.
+ source_node = source_str.___nodes___[0],

I hope this pull request will be OK for you to pull, but am open to better alternatives for the above issue.

# Works on Mobile

I have also tested this new feature on a Galaxy Nexus with Google Chrome Beta for Android 4.2.2 and the setting of the caret in the source code from error citations works well!

# Left for later

I have also been thinking about making the linking of the errors to the location in the source more explorable, both for desktop and mobile devices.

Only placeholder links come to mind.

They would be immediately visible even when not active, don't rely on hovering (which is not available reliably on touchscreens) or setting focus by tabbing thru the UI (also not available on mobile devices).

The markup as placeholder hyperlinks might not be pure, what do you think?