Fairy-lock
In folklore, fairy-locks are the result of fairies tangling and knotting the hairs of sleeping children and the manes of beasts as the fairies play in and out of their hair at night.
English tradition
The concept is first attested in English in Shakespeare's Romeo and Juliet in Mercutio's speech of the many exploits of Queen Mab, where he seems to imply the locks are only unlucky if combed out:Therefore, the appellation of elf lock or fairy lock could be attributed to any various tangles and knots of unknown origins appearing in the manes of beasts or hair of sleeping children.
It can also refer to tangles of elflocks or fairy-locks in human hair. In King Lear, when Edgar impersonates a madman, "elf all my hair in knots." What Edgar has done, simply put, is made a mess of his hair.
See also Jane Eyre, Ch. XIX; Jane's description of Rochester disguised as a gypsy: "... elf-locks bristled out from beneath a white band ..."