Skip to content

Questions/suggestions on solution to ' "Smart" tooltip ' #1653

Closed
@paroche

Description

@paroche

In the class definition for HoverIntent, it appears that there are statements in the constructor that are not related to assignments to this, specifically:

   elem.addEventListener("mouseover", this.onMouseOver);
   elem.addEventListener("mouseout", this.onMouseOut);

I imagine (it seems logical, and seems to be the way they function in the solution) that such statements are executed when new HoverIntent() is executed, but do not become part of the returned object.

But is this type of usage discussed anywhere in the tutorial up to this point? (Or after?). I haven't been able to find it. Actually, I haven't been able to find this type of constructor content discussed anywhere on the web, though I probably wasn't phrasing my search well enough.

So if is is discussed in the tutorial, could you point me at it? And if not, maybe it would be good to discuss it somewhere.


Also, the HoverIntent class definition contains the method destroy(), which I think is only used by the test script. If so, a little comment to that effect before it could be helpful. You know, // For the demo script or something.


Similarly, in the Index.html script section, the whole script seems to be labeled // for the demo, but if I'm understanding it correctly, it is only the setTimeout wrapper that is for the demo, while the contained new HoverIntent is necessary for the actual functioning of the tooltip. So I think the comment could be modified to say, say, // setTimeout is for the demo. However, I'm not really sure why the setTimeout is there -- the functionality and the demo seem to work fine if it is taken out, just leaving new HoverIntent({.....}) as shown in the instructions for the task. So I may be missing something there.


I don't know if this is what you prefer, but I broke some of my paragraphs up into shorter sub-paragraphs, and tried added an extra line separating the 'real' paragraphs, but it didn't work. Now using some funky HTML, which seems to work inconsistently here.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions