marklib

Dev tools

dom text selection library

SHOW HN2015

93points
42comments
#273of 2,565 in 2015
Top 11%of 2015 by points

How HN took it

DebatedReal support and real criticism

8 positive, 7 neutral or asking, 0 mixed, 7 critical, out of 22 comments about the project. Thread score +0.03.

Execution: 2 for, 5 againstIdea: 2 for, 1 againstDesign: 2 for, 1 against

The thread, comment by comment

Each row is a top-level comment and its replies, in HN's order. Select a cell to open that comment on HN.

positive neutral or mixed critical about another commenter or something else the maker

What HN said

What people liked

  • Works well and is a hard problem solved nicely

    From 2 comments
    • Well done! I know it is not an easy task to do. I built something fairly similar (and way less quick) http://jsfiddle.net/2XLBr/ and the git repo:…
      lepunk on HN
    • Well done - works surprisingly well on my iPhone. Working with text selection in the browser is notoriously difficult so I'm glad this works.
      thomasfoster96 on HN
  • Useful for persisting inline highlights

    From 2 comments
    • This is really great. I think we're going to use this for helping us highlight parts of the YC application that sticks out to the partners. Very interesting to see that what you…
      kevin on HN
    • Thank you. So am I correct in thinking this would be useful if you wanted to let people select a portion of an article and save just that portion to a database? (If so, I'll be…
      WaltPurvis on HN

Objections

  • Inconsistent selection behavior with triple-click and across browsers

    From 2 comments
    • I get inconsistent results when I triple-click to create the selection. For example, triple-clicking the word "Start" in the first paragraph highlights the entire first line,…
      pimlottc on HN
    • yeah, It will report the underlying textnode (if you are lucky). It's really inconsistent across browsers: some report the h1 tag, some the underlying node. Depends also how far…
      bowlingx on HN
  • Overlapping highlights render oddly

    From 2 comments
    • I noticed that you can mark an already marked section, which adds the marked color on top again, and again and again until you can't tell anymore because alpha = 100.
      dfar1 on HN
    • There is a weird behavior when you highlight something that has partially already been highlighted. I think you should take a look at how `preview` on osx does it. It cancels the…
      baby on HN
  • Serialized paths break when the document changes

    From 1 comment
    • It seems like using a tree-index based path, this serialization format would only work with purely static content. If you have a change to the underlying content (e.g. adding a…
      callmevlad on HN

Requests

  • Add a Chrome extension or bookmarklet

    From 2 comments
    • Seems like a good candidate for a bookmarklet that injects it into any page.
      lgas on HN
    • My thoughts exactly. This should be a chrome plugin.
      christiangenco on HN
  • Support multiple highlight colors in the demo

    From 1 comment
    • Thanks for sharing this. Great work!. I was wondering if it would mark a second time and third and I could test it in the small demo. It meet my expectations :) Great work! Two…
      alfonsodev on HN
  • Document the library in the README

    From 1 comment

Questions

  • How does it differ from rangy or getSelection()?

    From 2 comments
    • Did you take inspiration from Rangy (https://github.com/timdown/rangy) and if yes, what makes Marklib better? Would like to know if there are obvious benefits to using Marklib…
      pknight on HN
    • At the risk of sounding a bit grumpy but I'm genuine here, I seriously don't get this tool. Is not the same thing as getSelection() with a CSS background-color cherry on the top…
      notNow on HN
  • Can it work inside a textarea?

    From 1 comment
    • Is there a good library that does the same inside a textarea?
      sandaru1 on HN

Alternatives named

  • Rangy

    From 2 comments
    • Did you take inspiration from Rangy (https://github.com/timdown/rangy) and if yes, what makes Marklib better? Would like to know if there are obvious benefits to using Marklib…
      pknight on HN
    • We were working on a Medium-style text editor for a while and text selection is notoriously hard. Things like https://github.com/timdown/rangy somehow made it more palatable but…
      VeejayRampay on HN
  • MaSha

    From 1 comment
    • There is also https://github.com/SmartTeleMax/MaSha MaSha has ajax support. But no library supports multiple colors :(
      user3885 on HN
  • Point

    From 1 comment

Category, keywords, summaries and labels on this page were made by AI (Thread Reader v2) and not checked by hand. Each point links to the comments it came from.

Add a badge to your READMEShown on HackerShow
[![Shown on HackerShow](https://hackershow.org/badge.svg)](https://hackershow.org/show/9706633)