Opened 12 years ago

Closed 9 years ago

#8668 closed Bug (wontfix)

IE6&7 Meta tag names not set in commitMeta, or recognised in createMetaHash, in docprops plugin

Reported by: NicHolt Owned by:
Priority: Normal Milestone:
Component: General Version: 3.6
Keywords: IE6 IE7 HasPatch Cc:

Description (last modified by Jakub Ś)

IE6 and IE7 do not recognise the "name" attribute for a META element. For these versions of IE, in order to set the "name" attribute of a META element, it is necessary to set the "Name" (initial capital) attribute.

In commitMeta, the code should be:

				if ( CKEDITOR.env.ie && ( CKEDITOR.env.ie7Compat || CKEDITOR.env.ie6Compat ) ) {  
					meta.setAttribute( isHttp ? 'http-equiv' : 'Name', name )
				}
				else {
					meta.setAttribute( isHttp ? 'http-equiv' : 'name', name )
				}

In createMetaHash, the code should be:

			if ( CKEDITOR.env.ie && ( CKEDITOR.env.ie7Compat || CKEDITOR.env.ie6Compat ) ) {  
				hash[ meta.getAttribute( meta.hasAttribute( 'http-equiv' ) ? 'http-equiv' : 'Name' ).toLowerCase() ] = meta; 
			}
			else {
				hash[ meta.getAttribute( meta.hasAttribute( 'http-equiv' ) ? 'http-equiv' : 'name' ).toLowerCase() ] = meta; 
			}

TC is in comment_7, proposed fix in comment_8

Attachments (1)

meat.png (88.5 KB) - added by Jakub Ś 12 years ago.

Download all attachments as: .zip

Change History (12)

comment:1 Changed 12 years ago by Jakub Ś

Status: newpending
Version: 3.6.2

I was not able to reproduce that although I have tried different sorts of combinations with meta tag.

@NicHolt could you tell me exactly what sort of meta tag is causing the problem and also exactly how this problem occurs in code/docprops dialog or where ever?

comment:2 Changed 12 years ago by Jakub Ś

This ticket is related to #8612

comment:3 Changed 12 years ago by NicHolt

NicHolt could you tell me exactly what sort of meta tag is causing the problem and also exactly how this problem occurs in code/docprops dialog or where ever?

The original code in the 3.6.2 version attempts to update the "name" attribute of a meta tag. However, IE6 and IE7 only seem to recognise a "Name" attribute (note the capital "N". Therefore meta attributes are written back to the document with content only, and no name.

The proposed code uses the "Name" attribute for IE6 and IE7 in commitMeta, and the "name" attribute in other cases.

Changed 12 years ago by Jakub Ś

Attachment: meat.png added

comment:4 Changed 12 years ago by Jakub Ś

This one I still don't understand. Sorry.

If I use such tag inside editor in fullpage sample <meta content="some content" Name="THIS.Is.An.Upper.Case.Meta.Name." />, it is seen in developer toolbar as well as in source preview of the page Please see attachment.

Could I ask how do you know that name is not displayed in document?

Just a guess but perhaps you are using getAttribute method with flag set to 1 instead of default 0 (http://msdn.microsoft.com/en-us/library/ie/ms536429(v=vs.85).aspx)?

comment:5 Changed 12 years ago by NicHolt

Sorry, I should have made it clear that the "Name" vs "name" issue is in javascript, not in the HTML <META> tag itself. The CKEDITOR javascript attempts to set the "name" attribute, whereas M$, in IE7, only recognises the "Name" attribute.

comment:6 Changed 12 years ago by Jakub Ś

The same as in #8612

The original code in the 3.6.2 version attempts to update the "name" attribute of a meta tag. However, IE6 and IE7 only seem to recognize a "Name" attribute (note the capital "N". Therefore meta attributes are written back to the document with content only, and no name.

If I understand this correctly - using the below tags should cause:

<meta coNtent="some content" NAme="THIS.Is.An.Upper.Case.Meta.Name." />
<meta cONtent="George Costanza, gcostanza@vandalayindustries.com1234" namE="AUTHOR" />
<meta COntent="TEST" NAME="DESCRIPTIoN" />
  • Tags will not be visible in docProps Dialog - Not true
  • Updating such tag in docProps dialog will not take effect. The tag will be either unchanged or duplicated or will have no name - Not true.

Those values get updated/read even in IE6 IE7.


@NicHolt - I'm not sure if you have read this link -http://dev.ckeditor.com/wiki/TicketSpecs on how to report bugs but when I'm asking for a reduced sample I really mean it.

You keep giving me descriptions on how does CKEditor does something that it should - I understand but I can't reproduce it. Could you please, instead of those descriptions provide:

  1. Sample HTML page which allows to reproduce the problem. If not the page then this extended version of docProps dialog
  2. Explain step by step or show in screenshots or make some alerts/console.logs in JavaScript code what should we look at. What is the actual result and what is your expected result. This would save us both some time.

comment:7 Changed 12 years ago by NicHolt

Internet Explorer 7, version 7.0.5730.13, update version 0; Windows XP SP3, patched up-to-date

  1. Simple version of html page:
<html>
	<head>
		<title>CKEditor Sample</title>
	</head>
	<body>
		<p>
			This is some <strong>sample text</strong>. You are using <a href="http://ckeditor.com/">CKEditor</a>.</p>
	</body>
</html>

  1. Step by Step description
  1. Edit CKEditor Fullpage sample line 11 to use the _source version:
	<script type="text/javascript" src="../ckeditor_source.js"></script>

  1. Open CKEditor FullPage sample.
  2. Open the docprops dialog and set Author to "this is me".
  3. View Source
  4. Expected results:
<html>
	<head>
		<title>Editor sample with IE meta name fix</title>
		<meta content="this is me" name="author" />
	</head>
	<body>
		<p>
			This is some <strong>sample text</strong>. You are using <a href="http://ckeditor.com/">CKEditor</a>.</p>
	</body>
</html>

Actual results:

<html>
	<head>
		<title>CKEditor Sample</title>
		<meta content="this is me" />
	</head>
	<body>
		<p>
			This is some <strong>sample text</strong>. You are using <a href="http://ckeditor.com/">CKEditor</a>.</p>
	</body>
</html>

Note that the meta element has a content attribute, but not a name attribute.

I've been investigating further. In setAttribute in element.js I've temporarily modified the code as follows:

setAttribute : (function()
{
	var standard = function( name, value )
	{
		this.$.setAttribute( name, value );
		if (name == 'name') this.$.setAttribute('Name', value);
		return this;
	};


This works correctly.

In fact, if the first argument to this.$.setAttribute is "Name" or "NAME" or any capitalisation other than "name" it works correctly.

This is not a CKEditor bug, but just another in a long line of MS IE bugs associated with setAttribute. What I don't know is whether this bug is just confined to META elements, or whether it affects other element types.

I now think, btw, that any fix for this problem in relation to META elements is more appropriately placed in setAttribute in element.js rather than in the docProps dialog.

comment:8 Changed 12 years ago by NicHolt

Proposed fix: In _source/core/dom/element.js in setAttribute, replace the definition of "standard" with:

var standard = function( name, value )
{
	this.$.setAttribute( name, value );
	if ((name == 'name') && (this.$.tagName == 'META') && CKEDITOR.env.ie && ( CKEDITOR.env.ie7Compat || CKEDITOR.env.ie6Compat ))
	{
		try {this.$.setAttribute('Name', value)} // IE bug workaround for setAttribute for META elements
		catch (e) {}
	}
	return this;
};

Messy, but then IE workarounds invariably are!

Note that it IS necessary to set the META element name with both "name" and "Name", since otherwise changed values are not picked up in setupMeta.

Tested on IE7 and IE8 running in IE7 compatibility mode (as well as FF).

Last edited 12 years ago by Jakub Ś (previous) (diff)

comment:9 Changed 12 years ago by Jakub Ś

Keywords: IE6 IE7 HasPatch added
Status: pendingconfirmed
Version: 3.6

TC Reproducible from CKEditor 3.6 in IE6 and IE7

comment:10 Changed 12 years ago by Jakub Ś

Description: modified (diff)

comment:11 Changed 9 years ago by Jakub Ś

Resolution: wontfix
Status: confirmedclosed

IE6 and IE7 are no longer supported.

Note: See TracTickets for help on using tickets.
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy