Forum Moderators: open

Message Too Old, No Replies

How can I gain access to a "Behavior object"? SOS!

         

gappel

2:17 pm on Jul 20, 2004 (gmt 0)

10+ Year Member



Hi guys,

To make things short:
I have an HTML that uploads a behavior
<?IMPORT namespace="WM" implementation="https://hostName/pathName/bad_behavior.htc" >

I want to be able to access the "behavior object" after it loads. As far as I understand, uploaded behaviors become custom properties of the object in the context of which they were uploaded. ...Correct me if I am wrong.

Lets say that this is the behavior and the property I want to access is "DOM". How do I do that?

=================================
<PUBLIC:COMPONENT tagName="BADBEHAVIOR">
blah blah blah
<PUBLIC:PROPERTYname="DOM" get="get_DOM" />
blah blah blah
</PUBLIC:COMPONENT>

=================================

I am very not sure this is at all possible but the fact that the behavior has a name gives me some hope, otherwise why would behaviors need names?

Thanxx,
Greg.

korkus2000

3:24 pm on Jul 21, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I have never heard of the behavior object. Is it a javascript object or java?

Rambo Tribble

4:30 pm on Jul 21, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Perhaps this will be of some use: [support.microsoft.com...]

gappel

4:21 pm on Jul 22, 2004 (gmt 0)

10+ Year Member



As you probably know, MS behaviors are stored in .htc files the IE can upload using the import tag for example.

Per MS, once uploaded, behaviors become "something like" custom properties of the object in context of which the were requested.

Some methods and/or properties of behaviors can be made public to the caller i.e. can be made accessible from the DOM. That's what MS tells you!

But of course it's not even half the truth.
During download of .htc file, IE creates a weird object, which I call "behavior object". This thing has 3 visible members - "element", "defaults" and "document", where "element" is a real element object visible from window.document.childNodes[], and
"document" is an impared document object, which contains that bahavior's content.

But the killer is this.document!= window.document although this.document.parentWindow == window
And there is no access points to this.document from outside of "this".

So the question is how the **** am I suppose to get access to the "behavior object" from the DOM tree.
"Behavior object" is what I call "this".
Actually, I need to get to this.document
but that's irrelevant...

Bernard Marx

6:46 pm on Jul 22, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



this.document!= window.document

The behavior is an XML doc, I think. Whereas window.document is the main document.
Perhaps you could try looping the window in a for .. in to see if it reveals an object that looks like it holds a collection of behavior documents...

Internet Explorer creates a separate document tree for each use of an element behavior in the primary document.

[msdn.microsoft.com ]

Presumeably, these documents are properties of the window, or kept in a window collection.
...but then again...

[edited by: korkus2000 at 7:11 pm (utc) on July 22, 2004]
[edit reason] Fixed quote [/edit]

gappel

8:59 am on Jul 25, 2004 (gmt 0)

10+ Year Member



Thank you, Bernard!

The link you provided was the one I needed.

[msdn.microsoft.com...]

It says: The IMPORT PI is not a member of the all collection. However, the content of the IMPORT PI can be accessed from the document.body.innerHTML property.

What it means is - there is no access from the DOM tree to the content fetched by <?IMPORT>

Sad.