[jawsscripts] Re: Finding DOM element at the virtual cursor

  • From: Chad Foster <chad.foster@xxxxxxxxxx>
  • To: jawsscripts@xxxxxxxxxxxxx
  • Date: Wed, 11 Aug 2010 09:16:11 -0400

Yeah, using the VPC position will not work. Travis is right - those
x/y coords change as the user prefs change for the current page/HTML
content.

You can build some custom functions based on the GetTag functions -
coupling that info with the GetElementDescription info, you should be
able to figure out which object you are referencing. Here is the
pseudo code I was thinking:

1. Use GetElementDescription to find the tag associated with the
current VPC item. Keep track of all attributes here.
2. Loop through these tags on the current page using either the GetTag
functions or the DOM.
3. Look for your attributes you gathered in step 1.
4. Once you find the matching attributes, save the object pointer.


On 8/11/10, Travis Roth <travis@xxxxxxxxxxxxxx> wrote:
> If the GetTag functions return an index which represents the number of the
> tag as it occurs in the document, perhaps you can loop through until you
> find the element of that number in the document?
> I don't know if that's how the index works... But it seems a better chance
> than the column and row count which I think is just a JAWS thing. I suspect
> if you use the verbosity settings to change the line length of the virtual
> buffr you will find those numbers change which would indicate its just a
> JAWS stat.
>
> So that'd leave hoping a tag index works. Or doing some serious hacking such
> as with GreaseMonkey scripts in Firefox to add an ID to every element...
>
>
> -----Original Message-----
> From: jawsscripts-bounce@xxxxxxxxxxxxx
> [mailto:jawsscripts-bounce@xxxxxxxxxxxxx] On Behalf Of jaws tech
> Sent: Tuesday, August 10, 2010 10:48 PM
> To: jawsscripts@xxxxxxxxxxxxx
> Subject: [jawsscripts] Re: Finding DOM element at the virtual cursor
>
> I need a generic way to do this because the element that I am on may not
> have unique id or name information.  In fact the only thing that may come up
> for the elements I'm after are colspan=1 and one other one that I don't
> remember.  But those are not unique values.
> The GetTag functions only return an index not an object reference to an
> element.  I need to get an element as an object variable so I can then work
> within DOM functions.  Something like:
>
> oElement=insert code that I'm looking for
> saystring(oElement.innertext) (or some other DOM method/property)
>
> Like I said I prefer working in the DOM.  It is much more powerful/flexible
> than working with the JAWS functions.
>
> I was originally thinking of using the virtual cursor column position if
> that were in fact the sourceindex and then use code such as:
>
> iCol=GetCursorcol()
> oIE=IEGetCurrentDocument()
> oElement=oIE.all(iCol)
>
> But this wasn't working for some reason.  In fact, I don't even think I was
> succeeding in getting the "all" collection.  And as I alluded to in my
> original post, I don't know if the virtual cursor column represents the
> sourceindex of the document or not.
>
> Any other ideas??
>
>
>
> On Tue, Aug 10, 2010 at 9:53 PM, Chad Foster <chad.foster@xxxxxxxxxx> wrote:
>
>> Check out the GetTag functions. They can help you locate tags and
>> corresponding indices.
>>
>> On 8/10/10, Travis Roth <travis@xxxxxxxxxxxxxx> wrote:
>> > I've not tried it, but I'd suggest looking at the
>> > GetElementDescription() function and seeing if you can parse out the ID
> or name attribute.
>> > If an element doesn't have either of those its going to be difficult
>> > to
>> find
>> > in the DOM with JavaScript...
>> >
>> >
>> > -----Original Message-----
>> > From: jawsscripts-bounce@xxxxxxxxxxxxx
>> > [mailto:jawsscripts-bounce@xxxxxxxxxxxxx] On Behalf Of jaws tech
>> > Sent: Tuesday, August 10, 2010 5:45 PM
>> > To: jawsscripts@xxxxxxxxxxxxx
>> > Subject: [jawsscripts] Finding DOM element at the virtual cursor
>> >
>> > Hi All.
>> > I would like to find a reliable way to find the DOM element
>> > corresponding
>> to
>> > the current virtual cursor position.  I like to jump into the DOM
>> > when
>> doing
>> > IE scripting instead of the JAWS functions and I need a way to grab
>> > the current element.  As most of you already know the
>> > GetFocusedElement() functions just grab wherever the PC cursor is
>> > and have nothing to do with JAWS'
>> > virtual buffer.  Also, can someone explain the significance of the
>> > row
>> and
>> > column output of the Virtual cursor's position.  The column position
>> seems
>> > to correspond to the source index but I'm not sure what the row
>> > might represent??  Understanding this might shed some light on
>> > getting into the DOM.
>> >
>> > Thanks
>> >
>> >
>> > __________�
>> >
>> > View the list's information and change your settings at
>> > //www.freelists.org/list/jawsscripts
>> >
>> >
>> > __________�
>> >
>> > View the list's information and change your settings at
>> > //www.freelists.org/list/jawsscripts
>> >
>> >
>>
>>
>> --
>> Chad Foster
>> Access Technology Solutions
>> Leveling The Playing Field Through Technology http://www.GO-ATS.net
>> __________�
>>
>> View the list's information and change your settings at
>> //www.freelists.org/list/jawsscripts
>>
>>
>
> __________�
>
> View the list's information and change your settings at
> //www.freelists.org/list/jawsscripts
>
>
> __________�
>
> View the list's information and change your settings at
> //www.freelists.org/list/jawsscripts
>
>


-- 
Chad Foster
Access Technology Solutions
Leveling The Playing Field Through Technology
http://www.GO-ATS.net
__________�

View the list's information and change your settings at 
//www.freelists.org/list/jawsscripts

Other related posts: