bugs >> Bug in MSHTML (CSS handling) under VB

by Antonariy » Tue, 06 Feb 2007 20:26:21 GMT

I'm using WebBrowser control and Microsoft HTML Object Library in many
applications and I found some bugs. Most of them are fixed in latest version
of MSHTML, but this one persists.

I'm maiking an HTML table in VB like that:

t = "<table class='list'>"
For x=0 to y
t = t & "<tr>"
...
and so on. Then I'm settin this table to div's innerHTML -

lDiv.innerHTML = t

CSS class "list" looks like this (it is for keeping headers up in div with
overflow:auto like in DataGrid):

table.list th
{
background-color:Gray;
Z-INDEX: 2;
POSITION: relative;
TOP: expression(ParentDiv(this).scrollTop-2);
}

The problem is in rule "TOP". It is ignored. Expressions in rules don't work
after assigning html text to some innerHTML. But only under VB! It works
only in IE itself. Is it possible to fix this problem?




bugs >> Bug in MSHTML (CSS handling) under VB

by Antonariy » Tue, 06 Feb 2007 22:04:34 GMT


I understand now what is happening. I store original innerHTML of the div in
a string variable (template), from which make a table later. And this
variable has value:
<TABLE class=list id=tbl>
<THEAD>
<TR>
<TH style="TOP: -2px">1</TH>
<TH style="TOP: -2px">2</TH>
<TH style="TOP: -2px">3</TH>
<TH style="TOP: -2px"> </TH></TR></THEAD>

top:expression sets a value to style!
F**k!!!!
As I understand, there is no walkaround this behaviour. But it's easy to fix
MSHTML - if property of style depends of CSS class and its rule has an
expression, then building outer/innerHTML output must not include style!!!

I'm begging to show this report to MSHTML team because there is no
"mshtml.bugs" newsgroup :(





Similar Threads

1. Bug in Excel handling VBA/VBScript installation of Add-Ins

When you install and activate an Excel Add-In (.XLA) programmatically the 
first time, everything works as expected. However, if the installation is 
performed from a local (non-removable) drive, Excel will not copy it in the 
'C:\Documents and Settings\<user>\Application Data\Microsoft\AddIns' folder 
but leave it in the source folder and link to it.

When you try to update the same Add-In [programmatically] and you install it 
from a local drive AND from a different folder (such 'C:\AddInv2' instead of 
'C:\AddInv1') then Excel continues to link the first one. This also happens 
when you install it from a removable drive; here, however, the Add-In is 
copied to the '...\M$\AddIns' folder but then the Add-In might be exposed 
*twice* in the "Excel|Tools|Add-Ins"

Workaround:
- First programmatically unload the Add-in (Excel as Automation Server 
process must be killed otherwise the Registry is not updated, 
"ExcelApp.Close" is not enough)
- Remove the Add-In link from the Registry (using WMI since "Wscript.Shell" 
cannot do this due to a problem handling "\" characters in registry 
keys/values)
- If from a local drive, programmatically copy the Add-In to the 
'...\M$\AddIns' folder, otherwise use the "CopyFile := True" option when 
adding the Add-In via VBA
- Load the new Add-In programmatically

VBS source provided on request

2. Error handling bug on GetObject?

3. Error Handling - IADS bug ?

I have a script to create users. 

.......
On Error Resume Next

set objUser = objCIADS.Create("User", "CN=" & strFname & " "
&strLname)
objUser.Put "samAccountName", strAccName
objUser.SetInfo
if (Err.Number<>0) then
	Wscript.Echo "User Creation failed for " & strFname & " " &
strLname & vbcrdlf & _
	"With Error " & Err.Description & " - continuing"
.......


It works just fine. 

If I try and create a user that already exists then 
the error event is not triggered. If I omit the On Error Resume Next I
get an error saying the object already exists.

Is this a bug or have I got something wrong?

4. Bug in week-handling

5. Is this a bug in parameter handling?

I have a simple report with a string parameter '?Employee' and a selection 
formula that says '{EmpDetails.EmpCode} in [{?Employee}]'.  If I pass a 
single employee code to the report, it automatically encloses the code in " " 
and prints details for the employee, but if I pass 2 or more employee codes 
in ?Employee it prints nothing at all. (I suspect it treats the whole string 
as a single value).  I've tried to embed some " into the parameter I supply 
to make the string exactly the same as if I'd hard-coded 2 employee codes in 
the selection formula but it still won't work.  Anyone know how to pass a 
list of string values to the selection formula please, or is this a problem 
for Crystal?

6. Bug Submission: Microsoft Office for Mac (All Versions) VB Bug

7. mshtml & WebBrowser in VB.NET

Hi  everyone!
I'm writing a winform application using vb.net to hosts a 
webbrowser control (also known as AxInterop.SHDocVw).
I'm trying to catch the "oncontextmenu" event over the 
HTML page using this code:

Private Sub AxWebBrowser1_DocumentComplete(ByVal sender As 
Object, ByVal e As 
AxSHDocVw.DWebBrowserEvents2_DocumentCompleteEvent) 
Handles AxWebBrowser1.DocumentComplete
    Cursor.Current = Cursors.Default
    doc = DirectCast(AxWebBrowser1.Document, 
HTMLDocumentClass)        
        AddHandler CType(doc, 
mshtml.HTMLDocumentEvents2_Event).oncontextmenu, AddressOf 
Document_oncontextmenu            
    End Sub


Private Function Document_oncontextmenu(ByVal e As 
mshtml.IHTMLEventObj) As Boolean
        e.cancelBubble = True
        Return False
    End Function

In this example, "doc" is class variable defined as 
follows:

Private WithEvents doc As HTMLDocument

(I have also included the Dll Microsoft.mshtml.dll)

The question is:
why every element in the HTML page didn't works? 
(including links, buttons, text box ad so on...)
It is impossible to interact with the page...it seems 
frozen!
Thanks in advance
Giuseppe


8. convert to VB .Net code - Highlight text using mshtml.IMarkupServices - VB.Net