Support for XML Namespaces and some cosmetic changes #93

Closed
dnschnur opened this Issue Sep 28, 2012 · 4 comments

Projects

None yet

1 participant

@dnschnur
Member

Original author: pllamo...@gmail.com (December 13, 2007 01:00:50)

What steps will reproduce the problem?

  1. Use flot on a non html page. (xml+?)

What is the expected output? What do you see instead?
It doesn't work at all because the tag canvas is not supported in said
namespace.

What version of the product are you using? On what operating system?
Mozilla Firefox 2.0.0.11, jQuery 1.2.1, Flot 0.2 on a XUL page.

Please provide any additional information below.

Solution:
Use of document.createElementNS('http://www.w3.org/1999/xhtml', 'canvas')
instead of typed HTML where supported.

  1. Added support for Flot to coexist in a namespaced pages, if it doesn't
    support document.createElementNS fall back to document.createElement Also
    note I have added a div container under target so fixed absolute
    positionment works in this cases. I have also replaced every instance of
    innerHTML or typed HTML with their DOM equivalent functions so it should
    work where typed HTML didn't.
  2. Fixed alignment on legend cells where supported.
  3. Tabs instead of spaces, it was previously mixed.

Tested on IE6, IE7, Firefox2. All examples work.

PLL.

Original issue: http://code.google.com/p/flot/issues/detail?id=14

@dnschnur
Member

From olau%iol...@gtempaccount.com on December 13, 2007 18:40:01
Hi!

I have the following comments. It appears to me that the createElement changes should
go into jQuery rather than Flot as Flot is using standard jQuery syntax as far as I
know? Is there any reason this won't work? I'd rather have jQuery do what it's best
at, abstracting over platform details.

It's a bit hard to evaluate the other changes because they are mixed with the DOM stuff.

About the target: it's noted in the documentation that Flot will modify some
properties of it. I thought I had some reason for not inserting a custom-made div
inside, but maybe I just didn't think about absolute positioning. It's probably silly
not to support absolute out of the box, it's just going to cause confusion.

About the legend alignment: I'd like to hear the problem?

About tabs: you're right. I've hacked on Flot on a non-fixed Emacs, it must have
sneaked in the tabs.

@dnschnur
Member

From pllamo...@gmail.com on December 15, 2007 00:09:37
Hmm, something like "$.createElement"? I think it's fine either way since it's just a
shortcut to "document.createElementNS" if exists.

About the legend alignment, I added "vertical-align:middle;" to the cells of the
legend's table, works where supported and if the text wraps in many lines, the
field's box will still be centered.

Anyway, thanks for this awesome plugin.

@dnschnur
Member

From olau%iol...@gtempaccount.com on March 06, 2008 17:08:42
Thanks!

I can't reproduce the problem you describe with the legend alignment. If I add a long
legend text with a
, the box is aligned in the middle of the text. So I don't
think it needs to be hardcoded.

About the namespace stuff - I can see where you're coming from. But the typed HTML is
much faster, takes up less space and is also easier to read. If it doesn't work in a
XUL page, I think that the solution would be to fix up Firefox in some way so that it
can support HTML inside XML documents (this would also make other libraries work out
of the box).

Maybe Firefox needs support for saying "the following calls are to interpreted with
an HTML namespace" or "the default namespace is now HTML"?

@dnschnur
Member

From olau%iol...@gtempaccount.com on September 08, 2008 10:28:06
I'm going to close this now since it appears to me that it's not a Flot change that
needs to happen.

@dnschnur dnschnur closed this Sep 28, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment