capture 'Paste' event in text-area

Discussion in 'Javascript' started by RJ, Dec 5, 2008.

  1. RJ

    RJ Guest

    The scenario is.... there is a text-area that is used as chatbox where
    user enters their text msgs for chatting ..now it has a fixed width
    but the height increases according to the content.... now the problem
    that i am facing is whenver i do a cntrl+v on to the textarea , the
    height of the textarea does not increase according to the contents.
    I tried capturing the cntrl key event using "event.ctrlKey" on
    "onkeypress" event, but i works only for FF and fails in IE and
    chrome.

    Is there any way by which i can capture 'Paste' event......

    Any help wld be highly appreciated.

    Thanks,
    RJ
     
    RJ, Dec 5, 2008
    #1
    1. Advertising

  2. RJ

    Erwin Moller Guest

    RJ schreef:
    > The scenario is.... there is a text-area that is used as chatbox where
    > user enters their text msgs for chatting ..now it has a fixed width
    > but the height increases according to the content.... now the problem
    > that i am facing is whenver i do a cntrl+v on to the textarea , the
    > height of the textarea does not increase according to the contents.
    > I tried capturing the cntrl key event using "event.ctrlKey" on
    > "onkeypress" event, but i works only for FF and fails in IE and
    > chrome.
    >
    > Is there any way by which i can capture 'Paste' event......
    >
    > Any help wld be highly appreciated.
    >
    > Thanks,
    > RJ


    Hi,

    Have a look here:
    http://www.quirksmode.org/dom/w3c_events.html#keyprops

    Please note the listed keydown and keyup. keypress is NOT listed.

    Good luck.

    Regards,
    Erwin Moller


    --
    "There are two ways of constructing a software design: One way is to
    make it so simple that there are obviously no deficiencies, and the
    other way is to make it so complicated that there are no obvious
    deficiencies. The first method is far more difficult."
    -- C.A.R. Hoare
     
    Erwin Moller, Dec 5, 2008
    #2
    1. Advertising

  3. RJ

    David Mark Guest

    On Dec 5, 4:11 am, Erwin Moller
    <> wrote:
    > RJ schreef:
    >
    > > The scenario is.... there is a text-area that is used as chatbox where
    > > user enters their text msgs for chatting ..now it has a fixed width
    > > but the height increases according to the content.... now the problem
    > > that i am facing is whenver i do a cntrl+v on to the textarea , the
    > > height of the textarea does not increase according to the contents.
    > > I tried capturing the cntrl key event using "event.ctrlKey" on
    > > "onkeypress" event, but i works only for FF and fails in IE and
    > > chrome.

    >
    > > Is there any way by which i can capture 'Paste' event......

    >
    > > Any help wld be highly appreciated.

    >
    > > Thanks,
    > > RJ

    >
    > Hi,
    >
    > Have a look here:http://www.quirksmode.org/dom/w3c_events.html#keyprops
    >
    > Please note the listed keydown and keyup. keypress is NOT listed.
    >


    That site should not be treated as reference material. I consider it
    harmful as the descriptions of the "quirks" are often confused (among
    other things.)

    And I don't see the problem with the keypress event in general
    (whether it is listed on PPK's page or not.) Certainly none of the
    key* events will help with a keyboard accelerator like Ctrl+V, which
    is eaten by the browser.

    I believe IE has a proprietary paste event. Agents without such
    extensions will have to make do with keyup and change (keypress is
    clearly wrong in this context.)

    [snip]
     
    David Mark, Dec 5, 2008
    #3
  4. RJ

    David Mark Guest

    On Dec 5, 4:11 am, Erwin Moller
    <> wrote:
    > RJ schreef:
    >
    > > The scenario is.... there is a text-area that is used as chatbox where
    > > user enters their text msgs for chatting ..now it has a fixed width
    > > but the height increases according to the content.... now the problem
    > > that i am facing is whenver i do a cntrl+v on to the textarea , the
    > > height of the textarea does not increase according to the contents.
    > > I tried capturing the cntrl key event using "event.ctrlKey" on
    > > "onkeypress" event, but i works only for FF and fails in IE and
    > > chrome.

    >
    > > Is there any way by which i can capture 'Paste' event......

    >
    > > Any help wld be highly appreciated.

    >
    > > Thanks,
    > > RJ

    >
    > Hi,
    >
    > Have a look here:http://www.quirksmode.org/dom/w3c_events.html#keyprops
    >
    > Please note the listed keydown and keyup. keypress is NOT listed.
    >


    Didn't read that right the first time. It is correct that the
    properties *Key properties are not available during a keypress event,
    which only makes sense as the character code is "cooked" at that point.
     
    David Mark, Dec 5, 2008
    #4
  5. RJ

    Erwin Moller Guest

    David Mark schreef:
    > On Dec 5, 4:11 am, Erwin Moller
    > <> wrote:
    >> RJ schreef:
    >>
    >>> The scenario is.... there is a text-area that is used as chatbox where
    >>> user enters their text msgs for chatting ..now it has a fixed width
    >>> but the height increases according to the content.... now the problem
    >>> that i am facing is whenver i do a cntrl+v on to the textarea , the
    >>> height of the textarea does not increase according to the contents.
    >>> I tried capturing the cntrl key event using "event.ctrlKey" on
    >>> "onkeypress" event, but i works only for FF and fails in IE and
    >>> chrome.
    >>> Is there any way by which i can capture 'Paste' event......
    >>> Any help wld be highly appreciated.
    >>> Thanks,
    >>> RJ

    >> Hi,
    >>
    >> Have a look here:http://www.quirksmode.org/dom/w3c_events.html#keyprops
    >>
    >> Please note the listed keydown and keyup. keypress is NOT listed.
    >>

    >
    > That site should not be treated as reference material. I consider it
    > harmful as the descriptions of the "quirks" are often confused (among
    > other things.)


    Hi David,

    That table gives a nice overview which browser supports which metakeys.
    Allthough I never use quirksmode as a reference, its listings with
    compatibilities are useful and pleasantly presented and easily understood.

    Since the OP had troubles with support in different browser for the
    keypress this seems like a good place to start reading.

    Which website would you advise to look up this kind of information?

    Regards,
    Erwin Moller

    --
    "There are two ways of constructing a software design: One way is to
    make it so simple that there are obviously no deficiencies, and the
    other way is to make it so complicated that there are no obvious
    deficiencies. The first method is far more difficult."
    -- C.A.R. Hoare
     
    Erwin Moller, Dec 5, 2008
    #5
  6. RJ

    David Mark Guest

    On Dec 5, 6:56 am, Erwin Moller
    <> wrote:
    > David Mark schreef:
    >
    >
    >
    > > On Dec 5, 4:11 am, Erwin Moller
    > > <> wrote:
    > >> RJ schreef:

    >
    > >>> The scenario is.... there is a text-area that is used as chatbox where
    > >>> user enters their text msgs for chatting ..now it has a fixed width
    > >>> but the height increases according to the content.... now the problem
    > >>> that i am facing is whenver i do a cntrl+v on to the textarea , the
    > >>> height of the textarea does not increase according to the contents.
    > >>> I tried capturing the cntrl key event using "event.ctrlKey" on
    > >>> "onkeypress" event, but i works only for FF and fails in IE and
    > >>> chrome.
    > >>> Is there any way by which i can capture 'Paste' event......
    > >>> Any help wld be highly appreciated.
    > >>> Thanks,
    > >>> RJ
    > >> Hi,

    >
    > >> Have a look here:http://www.quirksmode.org/dom/w3c_events.html#keyprops

    >
    > >> Please note the listed keydown and keyup. keypress is NOT listed.

    >
    > > That site should not be treated as reference material.  I consider it
    > > harmful as the descriptions of the "quirks" are often confused (among
    > > other things.)

    >
    > Hi David,
    >
    > That table gives a nice overview which browser supports which metakeys.
    > Allthough I never use quirksmode as a reference, its listings with
    > compatibilities are useful and pleasantly presented and easily understood..
    >
    > Since the OP had troubles with support in different browser for the
    > keypress this seems like a good place to start reading.
    >
    > Which website would you advise to look up this kind of information?
    >


    Depends on what kind you mean. Quirksmode.org is okay for an overview
    of (some) browser differences, just ignore the attempts at explanation.
     
    David Mark, Dec 5, 2008
    #6
  7. RJ

    Erwin Moller Guest

    David Mark schreef:
    > On Dec 5, 6:56 am, Erwin Moller
    > <> wrote:
    >> David Mark schreef:
    >>
    >>
    >>
    >>> On Dec 5, 4:11 am, Erwin Moller
    >>> <> wrote:
    >>>> RJ schreef:
    >>>>> The scenario is.... there is a text-area that is used as chatbox where
    >>>>> user enters their text msgs for chatting ..now it has a fixed width
    >>>>> but the height increases according to the content.... now the problem
    >>>>> that i am facing is whenver i do a cntrl+v on to the textarea , the
    >>>>> height of the textarea does not increase according to the contents.
    >>>>> I tried capturing the cntrl key event using "event.ctrlKey" on
    >>>>> "onkeypress" event, but i works only for FF and fails in IE and
    >>>>> chrome.
    >>>>> Is there any way by which i can capture 'Paste' event......
    >>>>> Any help wld be highly appreciated.
    >>>>> Thanks,
    >>>>> RJ
    >>>> Hi,
    >>>> Have a look here:http://www.quirksmode.org/dom/w3c_events.html#keyprops
    >>>> Please note the listed keydown and keyup. keypress is NOT listed.
    >>> That site should not be treated as reference material. I consider it
    >>> harmful as the descriptions of the "quirks" are often confused (among
    >>> other things.)

    >> Hi David,
    >>
    >> That table gives a nice overview which browser supports which metakeys.
    >> Allthough I never use quirksmode as a reference, its listings with
    >> compatibilities are useful and pleasantly presented and easily understood.
    >>
    >> Since the OP had troubles with support in different browser for the
    >> keypress this seems like a good place to start reading.
    >>
    >> Which website would you advise to look up this kind of information?
    >>

    >
    > Depends on what kind you mean.


    I mean the kind that says which browser(version) supports which metakey.


    Quirksmode.org is okay for an overview
    > of (some) browser differences, just ignore the attempts at explanation.


    I take your word for it their explanations are bad.
    I possibly couldn't comment on that myself since I never used that site
    for anything else than quick compatibility lookups. ;-)

    But if you have some other resource that collects this kind of
    information ('this kind' meaning: 'browser compatibility lists for a lot
    of stuff an every day webdeveloper needs'), I'll be glad to hear where
    to find it.
    This quirksmode happens to be the only one I know of that has so much.

    Regards,
    Erwin Moller


    --
    "There are two ways of constructing a software design: One way is to
    make it so simple that there are obviously no deficiencies, and the
    other way is to make it so complicated that there are no obvious
    deficiencies. The first method is far more difficult."
    -- C.A.R. Hoare
     
    Erwin Moller, Dec 5, 2008
    #7
  8. RJ

    RJ Guest

    On Dec 5, 5:41 pm, Erwin Moller
    <> wrote:
    > David Mark schreef:
    >
    >
    >
    > > On Dec 5, 6:56 am, Erwin Moller
    > > <> wrote:
    > >> David Mark schreef:

    >
    > >>> On Dec 5, 4:11 am, Erwin Moller
    > >>> <> wrote:
    > >>>> RJ schreef:
    > >>>>> The scenario is.... there is a text-area that is used as chatbox where
    > >>>>> user enters their text msgs for chatting ..now it has a fixed width
    > >>>>> but the height increases according to the content.... now the problem
    > >>>>> that i am facing is whenver i do a cntrl+v on to the textarea , the
    > >>>>> height of the textarea does not increase according to the contents.
    > >>>>> I tried capturing the cntrl key event using "event.ctrlKey" on
    > >>>>> "onkeypress" event, but i works only for FF and fails in IE and
    > >>>>> chrome.
    > >>>>> Is there any way by which i can capture 'Paste' event......
    > >>>>> Any help wld be highly appreciated.
    > >>>>> Thanks,
    > >>>>> RJ
    > >>>> Hi,
    > >>>> Have a look here:http://www.quirksmode.org/dom/w3c_events.html#keyprops
    > >>>> Please note the listed keydown and keyup. keypress is NOT listed.
    > >>> That site should not be treated as reference material. I consider it
    > >>> harmful as the descriptions of the "quirks" are often confused (among
    > >>> other things.)
    > >> Hi David,

    >
    > >> That table gives a nice overview which browser supports which metakeys.
    > >> Allthough I never use quirksmode as a reference, its listings with
    > >> compatibilities are useful and pleasantly presented and easily understood.

    >
    > >> Since the OP had troubles with support in different browser for the
    > >> keypress this seems like a good place to start reading.

    >
    > >> Which website would you advise to look up this kind of information?

    >
    > > Depends on what kind you mean.

    >
    > I mean the kind that says which browser(version) supports which metakey.
    >
    > Quirksmode.org is okay for an overview
    >
    > > of (some) browser differences, just ignore the attempts at explanation.

    >
    > I take your word for it their explanations are bad.
    > I possibly couldn't comment on that myself since I never used that site
    > for anything else than quick compatibility lookups. ;-)
    >
    > But if you have some other resource that collects this kind of
    > information ('this kind' meaning: 'browser compatibility lists for a lot
    > of stuff an every day webdeveloper needs'), I'll be glad to hear where
    > to find it.
    > This quirksmode happens to be the only one I know of that has so much.
    >
    > Regards,
    > Erwin Moller
    >
    > --
    > "There are two ways of constructing a software design: One way is to
    > make it so simple that there are obviously no deficiencies, and the
    > other way is to make it so complicated that there are no obvious
    > deficiencies. The first method is far more difficult."
    > -- C.A.R. Hoare




    Very Thanks to all for ur replies...... but i haven't got solution to
    my problem as to how to increase height of the text area when contents
    are pasted into it.

    Now the thing is "keypress" event yields result in FF, but not with IE
    and others, for IE and rest , the option available is "onkeyup" and
    "onkeydown", but then the corresponding function would be called twice
    for "cntrl+v" and hence that option will also won't work..... and
    regarding "onpaste" event , it is only applicable for IE. I am sure
    der must be some way to achieve this task.....

    Guys, if you can help....

    Thanks,
    RJ
     
    RJ, Dec 8, 2008
    #8
  9. RJ

    David Mark Guest

    On Dec 8, 1:45 am, RJ <> wrote:

    [snip]

    > Very Thanks to all for ur replies...... but i haven't got solution to
    > my problem as to how to increase height of the text area when contents
    > are pasted into it.


    Yes. Among other things.

    >
    > Now the thing is "keypress" event yields result in FF, but not with IE
    > and others, for IE and rest , the option available is "onkeyup" and
    > "onkeydown", but then the corresponding function would be called twice


    No.

    > for "cntrl+v" and hence that option will also won't work..... and
    > regarding "onpaste" event , it is only applicable for IE. I am sure
    > der must be some way to achieve this task.....


    Trying to intercept an OS-specific keyboard accelerator (e.g. Ctrl+V)
    is silly. The paste event is available in IE. Other than that, you
    are SOL AFAIK.

    [snip]
     
    David Mark, Dec 8, 2008
    #9
  10. RJ

    RJ Guest

    On Dec 8, 2:27 pm, David Mark <> wrote:
    > On Dec 8, 1:45 am, RJ <> wrote:
    >
    > [snip]
    >
    > > Very Thanks to all for ur replies...... but i haven't got solution to
    > > my problem as to how to increase height of the text area when contents
    > > are pasted into it.

    >
    > Yes. Among other things.
    >
    >
    >
    > > Now the thing is "keypress" event yields result in FF, but not with IE
    > > and others, for IE and rest , the option available is "onkeyup" and
    > > "onkeydown", but then the corresponding function would be called twice

    >
    > No.
    >
    > > for "cntrl+v" and hence that option will also won't work..... and
    > > regarding "onpaste" event , it is only applicable for IE. I am sure
    > > der must be some way to achieve this task.....

    >
    > Trying to intercept an OS-specific keyboard accelerator (e.g. Ctrl+V)
    > is silly. The paste event is available in IE. Other than that, you
    > are SOL AFAIK.
    >
    > [snip]


    ya.... 2 days of research yet no result... even i feel m SOL.... but i
    have seen some application(especially facebook), where this particular
    thing has been achieved..

    I'll posts in if i get a soln... meanwhile if anybody know how to
    tackle it....

    Thanks,
    RJ
     
    RJ, Dec 8, 2008
    #10
  11. RJ

    David Mark Guest

    On Dec 8, 6:32 am, RJ <> wrote:
    > On Dec 8, 2:27 pm, David Mark <> wrote:
    >
    >
    >
    > > On Dec 8, 1:45 am, RJ <> wrote:

    >
    > > [snip]

    >
    > > > Very Thanks to all for ur replies...... but i haven't got solution to
    > > > my problem as to how to increase height of the text area when contents
    > > > are pasted into it.

    >
    > > Yes.  Among other things.

    >
    > > > Now the thing is "keypress" event yields result in FF, but not with IE
    > > > and others, for IE and rest , the option available is "onkeyup" and
    > > > "onkeydown", but then the corresponding function would be called twice

    >
    > > No.

    >
    > > > for "cntrl+v" and hence that option will also won't work..... and
    > > > regarding "onpaste" event , it is only applicable for IE. I am sure
    > > > der must be some way to achieve this task.....

    >
    > > Trying to intercept an OS-specific keyboard accelerator (e.g. Ctrl+V)
    > > is silly.  The paste event is available in IE.  Other than that, you
    > > are SOL AFAIK.

    >
    > > [snip]

    >
    > ya.... 2 days of research yet no result... even i feel m SOL.... but i
    > have seen some application(especially facebook), where this particular
    > thing has been achieved..


    Really? And how much of those two days was spent looking at their
    code?

    [snip]
     
    David Mark, Dec 8, 2008
    #11
  12. RJ

    RJ Guest

    On Dec 8, 4:38 pm, David Mark <> wrote:
    > On Dec 8, 6:32 am, RJ <> wrote:
    >
    >
    >
    > > On Dec 8, 2:27 pm, David Mark <> wrote:

    >
    > > > On Dec 8, 1:45 am, RJ <> wrote:

    >
    > > > [snip]

    >
    > > > > Very Thanks to all for ur replies...... but i haven't got solution to
    > > > > my problem as to how to increase height of the text area when contents
    > > > > are pasted into it.

    >
    > > > Yes. Among other things.

    >
    > > > > Now the thing is "keypress" event yields result in FF, but not with IE
    > > > > and others, for IE and rest , the option available is "onkeyup" and
    > > > > "onkeydown", but then the corresponding function would be called twice

    >
    > > > No.

    >
    > > > > for "cntrl+v" and hence that option will also won't work..... and
    > > > > regarding "onpaste" event , it is only applicable for IE. I am sure
    > > > > der must be some way to achieve this task.....

    >
    > > > Trying to intercept an OS-specific keyboard accelerator (e.g. Ctrl+V)
    > > > is silly. The paste event is available in IE. Other than that, you
    > > > are SOL AFAIK.

    >
    > > > [snip]

    >
    > > ya.... 2 days of research yet no result... even i feel m SOL.... but i
    > > have seen some application(especially facebook), where this particular
    > > thing has been achieved..

    >
    > Really? And how much of those two days was spent looking at their
    > code?
    >
    > [snip]


    none actually.....but AFAIK, facebook uses their own DOM elements..
     
    RJ, Dec 8, 2008
    #12
  13. RJ

    RJ Guest

    On Dec 8, 4:38 pm, David Mark <> wrote:
    > On Dec 8, 6:32 am, RJ <> wrote:
    >
    >
    >
    > > On Dec 8, 2:27 pm, David Mark <> wrote:

    >
    > > > On Dec 8, 1:45 am, RJ <> wrote:

    >
    > > > [snip]

    >
    > > > > Very Thanks to all for ur replies...... but i haven't got solution to
    > > > > my problem as to how to increase height of the text area when contents
    > > > > are pasted into it.

    >
    > > > Yes. Among other things.

    >
    > > > > Now the thing is "keypress" event yields result in FF, but not with IE
    > > > > and others, for IE and rest , the option available is "onkeyup" and
    > > > > "onkeydown", but then the corresponding function would be called twice

    >
    > > > No.

    >
    > > > > for "cntrl+v" and hence that option will also won't work..... and
    > > > > regarding "onpaste" event , it is only applicable for IE. I am sure
    > > > > der must be some way to achieve this task.....

    >
    > > > Trying to intercept an OS-specific keyboard accelerator (e.g. Ctrl+V)
    > > > is silly. The paste event is available in IE. Other than that, you
    > > > are SOL AFAIK.

    >
    > > > [snip]

    >
    > > ya.... 2 days of research yet no result... even i feel m SOL.... but i
    > > have seen some application(especially facebook), where this particular
    > > thing has been achieved..

    >
    > Really? And how much of those two days was spent looking at their
    > code?
    >
    > [snip]


    none actually.....but AFAIK, facebook uses their own DOM elements..
     
    RJ, Dec 8, 2008
    #13
  14. RJ

    RJ Guest

    On Dec 8, 4:38 pm, David Mark <> wrote:
    > On Dec 8, 6:32 am, RJ <> wrote:
    >
    >
    >
    > > On Dec 8, 2:27 pm, David Mark <> wrote:

    >
    > > > On Dec 8, 1:45 am, RJ <> wrote:

    >
    > > > [snip]

    >
    > > > > Very Thanks to all for ur replies...... but i haven't got solution to
    > > > > my problem as to how to increase height of the text area when contents
    > > > > are pasted into it.

    >
    > > > Yes. Among other things.

    >
    > > > > Now the thing is "keypress" event yields result in FF, but not with IE
    > > > > and others, for IE and rest , the option available is "onkeyup" and
    > > > > "onkeydown", but then the corresponding function would be called twice

    >
    > > > No.

    >
    > > > > for "cntrl+v" and hence that option will also won't work..... and
    > > > > regarding "onpaste" event , it is only applicable for IE. I am sure
    > > > > der must be some way to achieve this task.....

    >
    > > > Trying to intercept an OS-specific keyboard accelerator (e.g. Ctrl+V)
    > > > is silly. The paste event is available in IE. Other than that, you
    > > > are SOL AFAIK.

    >
    > > > [snip]

    >
    > > ya.... 2 days of research yet no result... even i feel m SOL.... but i
    > > have seen some application(especially facebook), where this particular
    > > thing has been achieved..

    >
    > Really? And how much of those two days was spent looking at their
    > code?
    >
    > [snip]


    none actually.....but AFAIK, facebook uses their own DOM elements..
     
    RJ, Dec 8, 2008
    #14
  15. RJ

    David Mark Guest

    On Dec 8, 8:19 am, RJ <> wrote:
    > On Dec 8, 4:38 pm, David Mark <> wrote:
    >
    >
    >
    > > On Dec 8, 6:32 am, RJ <> wrote:

    >
    > > > On Dec 8, 2:27 pm, David Mark <> wrote:

    >
    > > > > On Dec 8, 1:45 am, RJ <> wrote:

    >
    > > > > [snip]

    >
    > > > > > Very Thanks to all for ur replies...... but i haven't got solution to
    > > > > > my problem as to how to increase height of the text area when contents
    > > > > > are pasted into it.

    >
    > > > > Yes.  Among other things.

    >
    > > > > > Now the thing is "keypress" event yields result in FF, but not with IE
    > > > > > and others, for IE and rest , the option available is "onkeyup" and
    > > > > > "onkeydown", but then the corresponding function would be called twice

    >
    > > > > No.

    >
    > > > > > for "cntrl+v" and hence that option will also won't work..... and
    > > > > > regarding "onpaste" event , it is only applicable for IE. I am sure
    > > > > > der must be some way to achieve this task.....

    >
    > > > > Trying to intercept an OS-specific keyboard accelerator (e.g. Ctrl+V)
    > > > > is silly.  The paste event is available in IE.  Other than that, you
    > > > > are SOL AFAIK.

    >
    > > > > [snip]

    >
    > > > ya.... 2 days of research yet no result... even i feel m SOL.... but i
    > > > have seen some application(especially facebook), where this particular
    > > > thing has been achieved..

    >
    > > Really?  And how much of those two days was spent looking at their
    > > code?

    >
    > > [snip]

    >
    > none actually.....but AFAIK, facebook uses their own DOM elements..


    That is meaningless.
     
    David Mark, Dec 8, 2008
    #15
  16. RJ

    Erwin Moller Guest

    RJ schreef:
    > On Dec 8, 4:38 pm, David Mark <> wrote:
    >> On Dec 8, 6:32 am, RJ <> wrote:
    >>
    >>


    >>> ya.... 2 days of research yet no result... even i feel m SOL.... but i
    >>> have seen some application(especially facebook), where this particular
    >>> thing has been achieved..

    >> Really? And how much of those two days was spent looking at their
    >> code?
    >>
    >> [snip]

    >
    > none actually.....but AFAIK, facebook uses their own DOM elements..


    Huh? What do you mean by that?
    Isn't the DOM defined by the browser?
    Facebook is only manipulating the DOM.

    Anyway, I think you can inspect their approach just fine.
    Simply look at the code returned to your browser.
    If they use JavaScript includes, simply fetch them too by hand for
    futher inspection.
    Start by looking for eventhandlers attached to the element, and see if
    you can find out how they approach it.

    Tip: You may have an easier time if you use FF with Firebug installed.

    Regards,
    Erwin Moller

    PS: I still don't understand what is wrong with using the keyup event
    you mentioned earlier.
    Simply attach an eventhandler to your textarea, and check if the key in
    question was 'v' AND if also the metakey ctrl is pressed at that time,
    do your thing. Why doesn't that work for you?


    --
    "There are two ways of constructing a software design: One way is to
    make it so simple that there are obviously no deficiencies, and the
    other way is to make it so complicated that there are no obvious
    deficiencies. The first method is far more difficult."
    -- C.A.R. Hoare
     
    Erwin Moller, Dec 8, 2008
    #16
  17. RJ

    RJ Guest

    On Dec 8, 9:38 pm, Erwin Moller
    <> wrote:
    > RJ schreef:
    >
    > > On Dec 8, 4:38 pm, David Mark <> wrote:
    > >> On Dec 8, 6:32 am, RJ <> wrote:

    >
    > >>> ya.... 2 days of research yet no result... even i feel m SOL.... but i
    > >>> have seen some application(especially facebook), where this particular
    > >>> thing has been achieved..
    > >> Really? And how much of those two days was spent looking at their
    > >> code?

    >
    > >> [snip]

    >
    > > none actually.....but AFAIK, facebook uses their own DOM elements..

    >
    > Huh? What do you mean by that?
    > Isn't the DOM defined by the browser?
    > Facebook is only manipulating the DOM.
    >
    > Anyway, I think you can inspect their approach just fine.
    > Simply look at the code returned to your browser.
    > If they use JavaScript includes, simply fetch them too by hand for
    > futher inspection.
    > Start by looking for eventhandlers attached to the element, and see if
    > you can find out how they approach it.
    >
    > Tip: You may have an easier time if you use FF with Firebug installed.
    >
    > Regards,
    > Erwin Moller
    >
    > PS: I still don't understand what is wrong with using the keyup event
    > you mentioned earlier.
    > Simply attach an eventhandler to your textarea, and check if the key in
    > question was 'v' AND if also the metakey ctrl is pressed at that time,
    > do your thing. Why doesn't that work for you?
    >
    > --
    > "There are two ways of constructing a software design: One way is to
    > make it so simple that there are obviously no deficiencies, and the
    > other way is to make it so complicated that there are no obvious
    > deficiencies. The first method is far more difficult."
    > -- C.A.R. Hoare


    keyup event fires twice for cntrl+v in ff ..... hmmm i'll have to
    inspect what facebook guys are doing...will kleep u guys updated on my
    progress.

    Thanks all for ur replies
     
    RJ, Dec 9, 2008
    #17
  18. RJ

    David Mark Guest

    On Dec 9, 12:28 am, RJ <> wrote:
    > On Dec 8, 9:38 pm, Erwin Moller
    >
    >
    >
    > <> wrote:
    > > RJ schreef:

    >
    > > > On Dec 8, 4:38 pm, David Mark <> wrote:
    > > >> On Dec 8, 6:32 am, RJ <> wrote:

    >
    > > >>> ya.... 2 days of research yet no result... even i feel m SOL.... but i
    > > >>> have seen some application(especially facebook), where this particular
    > > >>> thing has been achieved..
    > > >> Really?  And how much of those two days was spent looking at their
    > > >> code?

    >
    > > >> [snip]

    >
    > > > none actually.....but AFAIK, facebook uses their own DOM elements..

    >
    > > Huh? What do you mean by that?
    > > Isn't the DOM defined by the browser?
    > > Facebook is only manipulating the DOM.

    >
    > > Anyway, I think you can inspect their approach just fine.
    > > Simply look at the code returned to your browser.
    > > If they use JavaScript includes, simply fetch them too by hand for
    > > futher inspection.
    > > Start by looking for eventhandlers attached to the element, and see if
    > > you can find out how they approach it.

    >
    > > Tip: You may have an easier time if you use FF with Firebug installed.

    >
    > > Regards,
    > > Erwin Moller

    >
    > > PS: I still don't understand what is wrong with using the keyup event
    > > you mentioned earlier.
    > > Simply attach an eventhandler to your textarea, and check if the key in
    > > question was 'v' AND if also the metakey ctrl is pressed at that time,
    > > do your thing. Why doesn't that work for you?

    >
    > > --
    > > "There are two ways of constructing a software design: One way is to
    > > make it so simple that there are obviously no deficiencies, and the
    > > other way is to make it so complicated that there are no obvious
    > > deficiencies. The first method is far more difficult."
    > > -- C.A.R. Hoare

    >
    > keyup event fires twice for cntrl+v in ff ..... hmmm i'll have to


    As mentioned, it is silly to even attempt to detect Ctrl+V. What do
    you think that means outside of Windows? Also, what if the paste (or
    whatever) operation is done through the edit menu?

    > inspect what facebook guys are doing...will kleep u guys updated on my
    > progress.


    They are likely using setInterval to poll the value of the textarea
    and resizing when it changes. I can't imagine anything else that
    would work reliably cross-browser.

    [snip]
     
    David Mark, Dec 9, 2008
    #18
  19. RJ

    Erwin Moller Guest

    David Mark schreef:

    > As mentioned, it is silly to even attempt to detect Ctrl+V. What do
    > you think that means outside of Windows? Also, what if the paste (or
    > whatever) operation is done through the edit menu?


    Hmm, you right of course.
    And what is worse, you wrote that before. (slaps head)

    RJ, are you still reading this?
    Don't go that route ctrl-v route.

    Erwin

    --
    "There are two ways of constructing a software design: One way is to
    make it so simple that there are obviously no deficiencies, and the
    other way is to make it so complicated that there are no obvious
    deficiencies. The first method is far more difficult."
    -- C.A.R. Hoare
     
    Erwin Moller, Dec 9, 2008
    #19
  20. RJ

    RJ Guest

    On Dec 9, 2:18 pm, Erwin Moller
    <> wrote:
    > David Mark schreef:
    >
    > > As mentioned, it is silly to even attempt to detect Ctrl+V. What do
    > > you think that means outside of Windows? Also, what if the paste (or
    > > whatever) operation is done through the edit menu?

    >
    > Hmm, you right of course.
    > And what is worse, you wrote that before. (slaps head)
    >
    > RJ, are you still reading this?
    > Don't go that route ctrl-v route.
    >
    > Erwin
    >
    > --
    > "There are two ways of constructing a software design: One way is to
    > make it so simple that there are obviously no deficiencies, and the
    > other way is to make it so complicated that there are no obvious
    > deficiencies. The first method is far more difficult."
    > -- C.A.R. Hoare


    hmmm... cntrl+v method wnt suffice.
    David has suggested a good technique.... will try dat and let u guys
    know..

    Thanks all (especially David)
     
    RJ, Dec 9, 2008
    #20
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Mark
    Replies:
    1
    Views:
    625
    Larry Barowski
    Jun 27, 2005
  2. hotadvice
    Replies:
    14
    Views:
    725
    hotadvice
    Oct 2, 2007
  3. Andy B.
    Replies:
    0
    Views:
    834
    Andy B.
    Apr 30, 2010
  4. leo
    Replies:
    1
    Views:
    306
    Bob Lehmann
    Dec 5, 2005
  5. Jim
    Replies:
    0
    Views:
    201
Loading...

Share This Page