× Joomla Facebook Connect support forum

Topic-icon Latest version still not XHTML compliat

Active Subscriptions:

None
14 years 3 weeks ago #22850 by ondvý
Hi team,
thanks for great component. Today tried latest version to have new functionality available but I'm bit disappointed and falling back to older (tuned) version that I've made XHTML compliant - it's essential for me. Sorry do want to invest another 2 days for tuning current version to make it work as described here www.sourcecoast.com/forums/jfbconnect/sh...-optimalizovane-itcz

Errors I can see now:
required attribute "type" not specified
document type does not allow element "link" here
there is no attribute "v"
there is no attribute "size"
there is no attribute "scope"
there is no attribute "onlogin"
element "fb:login-button" undefined
there is no attribute "data-url"
an attribute specification must start with a name or name token
there is no attribute "size"
there is no attribute "annotation"
there is no attribute "href"
there is no attribute "href"
element "g:plusone" undefined
there is no attribute "href"
there is no attribute "show_faces"
there is no attribute "send"
there is no attribute "layout"
there is no attribute "width"
there is no attribute "action"
there is no attribute "font"
there is no attribute "colorscheme"
element "fb:like" undefined

so back on 4.1.2 again and XHTML compliancy back. To be honest I expect to respect standards from commercial product.

If there is some guide / new version to make it work, let me know

Regards, Ondrej
The topic has been locked.
Support Specialist
14 years 3 weeks ago #22863 by alzander
Ondrej,
HTML validation is something we try to get 'as right as possible', but there are times when it's not possible to do so without compromising in other areas or conflicting with other extensions/templates.

I honestly hadn't seen your post in the other forum. The "Showcase" forum isn't monitored for tech support or suggestions as much as the other 'support' forums, so I never responded there. I'm copying most of the post you made here (and then removing it from there), and I'll respond to each of your points.

First, though, please know that we highly prioritize any usability issues. If there are graphical problems or functional problems on your site, we'll gladly do everything we can to fix them. The validation issues that are introduced by JFBConnect / Facebook almost never cause these types of problems though, so they are much lower priority, if they can be fixed. Also, keep in mind, that almost all sites do not properly validate including Google, Apple, Amazon, Mozilla (Firefox), Facebook, and Joomla's home page.

Now, for your specific points:

1st thing needs to be done and this is related to the template is to change DOC TYPE to:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML+RDFa 1.0//EN" "www.w3.org/MarkUp/DTD/xhtml-rdfa-1.dtd">

Changing the Doctype of a page changes how the browser is meant to parse the page. Almost all Joomla templates use the "XHTML 1.0 Transitional" doctype, or the Strict type. Switching to the RDFa type may clear up validation issues, but it may also cause your template and output to be parsed, read and displayed completely differently. There's no way we could 'force' the doctype to something else for all users as it would likely cause issues for many users and would go against what template developers intended.

This is a compromise that is, unfortunately, necessary when using a CMS. Facebook has made their choice to recommend that Doctype, but has also gone out of their way to ensure that on non-conforming doctypes, their widgets (Like, Comment, etc) will display properly, even if there are validation issues.

Custom code for tags

remaining changes are about replacing standard html elements that are not valid due to the attributes and render elements using JavaScript
2nd changes are related to the components/com_jfbconnect/libraries/facebook.php to change login button
row 320 return '
if ($showSendButton == "false" || $showSendButton == "0")
$showSendButton="false";
else
$showSendButton="true";

$likeButtonText = '
var fbl = document.createElement("fb:like");
fbl.setAttribute("href","'.$url.'");
fbl.setAttribute("show_faces","'.$showFaces.'");
fbl.setAttribute("send","'.$showSendButton.'");
fbl.setAttribute("layout","'.$buttonStyle.'");
fbl.setAttribute("width","200");
fbl.setAttribute("action","'.$verbToDisplay.'");
fbl.setAttribute("font","'.$font.'");
fbl.setAttribute("colorscheme","'.$colorScheme.'");
document.getElementById("jfbcl").appendChild(fbl);
';

FAN button - function _getJFBCFan
original $fanString commented and replaced with
if ($showFaces == "false" || $showFaces == "0")
$showFaces="false";
else
$showFaces="true";

if ($header == "false" || $header == "0")
$header="false";
else
$header="true";

if ($stream == "false" || $stream == "0")
$stream="false";
else
$stream="true";

$fanString = '
var fbf = document.createElement("fb:like-box");
fbf.setAttribute("href","'.$href.'");
fbf.setAttribute("show_faces","'.$showFaces.'");
fbf.setAttribute("stream","'.$stream.'");
fbf.setAttribute("header","'.$header.'");
fbf.setAttribute("width","'.$width.'");
fbf.setAttribute("height","'.$height.'");
fbf.setAttribute("colorscheme","'.$colorScheme.'");
fbf.setAttribute("border_color","'.$$borderColor.'");
document.getElementById("jfbf").appendChild(fbf);
';

Twitter Button - function _getSCTwitterShare
original tagButtonText commented and replaced with
$tagButtonText.='
var tb = document.createElement("a");
tb.setAttribute("class", "twitter-share-button");
tb.setAttribute("href","javascript:http://twitter.com/share");
tb.setAttribute("data-url", "'.$url.'");
tb.setAttribute("data-count", "'.$dataCount.'");
document.getElementById("tweetbutton").appendChild(tb);
';

Google plus button function _getSCGPlusOne
original tabButtonText commented and replaced with
$tagButtonText='
var gp = document.createElement("g:plusone");
gp.setAttribute("size", "'.$size.'");
gp.setAttribute("href","'.$url.'");
gp.setAttribute("annotation", "'.$annotation.'");
document.getElementById("gplus").appendChild(gp);
';

I know this is not the best options especially when button are rendered in cathegory,... view if there is more button - div id must be modified to have unique tags. but as I'm displaying only in the content view - it work ok for me.
Functionality is same like with standard html tags but as this solution renders via java script there are no attributes,... in the html structure and document is valid.

I haven't tested the code you mention, but I'll take your word that it works. However, creating the identical elements using Javascript still will cause validation issues on the page. Most validation checkers don't parse Javascript, but Google and browsers and add-ons definitely do. If your concern is that you don't want validation issues, you're simply masking them by doing this, since the standard validator.w3.org/ page simply doesn't process the Javascript (which would then add tags that violate the doctype).

Additionally, using the Javascript to do it will slow down the overall page load time. For a page with one or 2 widgets (a like button here and the login button there), that's not a big deal. For a blog view with 10 articles, the 4 social buttons on each and a comment box, the Javascript would slow the page down drastically.

Hope that all makes sense and explains our reasoning. Again, if you are aware of any issues that are caused by the validation issues, we'll gladly go out of our way to fix them.

Thanks for your feedback,
Alex
The topic has been locked.
Active Subscriptions:

None
14 years 2 weeks ago #22878 by ondvý
Hi Alex,
Thanks for your answer - I understand to what you're mentioned.
About the DOCTYPE it took me a while to correct my template and it is always tradeoff - compliant html code or easy to use code.
Maybe bit more theoretical discussion :)
It will be great to give option do you want to have compliant site with longer load time or faster non-compliant site?
As I see many of extensions for Joomla I prefer to have compliant and sometimes developers are focusing on functionality only - not you guys.

Generaly speaking - does it mean that Facebook, Google any other application using own html extensibility means to not to be compliant with w3c standards to make it work? I don't think so.

About page load speed - I can understand that if you have more js on the webpage it decreases page load time it this is the reason why I decided to not to have social plugin (even in unmodified version because huge communication between site/client and social webs). When I check current page load time of the web page now
homepage: onload3.5sec (social communication takes about 1.5sec), reload700ms - homepage includes fblogin and fbfan
article: onload 2.5sec (social communication takes about 1.2sec), reload 1.1sec (social communication takes about 700ms) - including fblogin, fblike, g+, twitter

I can understand what are the js doing to work with validator but I haven't found any other option "how to"

I think those times are ok and same time is required for social communication anyway.
So if it is possible to have an option compliant / speed I'll appreciate this option.
Or if can give me some advice where to make modifications :)

To be honest - you have the BEST social media plugin ever tested so I want to just help to make it better and maybe to give you feedback from the field.

If there will be no update regards xhtml in future - I'll spent some time again to get latest version working as it is now :)

Have a great weekend, Ondrej
The topic has been locked.
Support Specialist
14 years 2 weeks ago #22927 by alzander
Ondrej,
We get about 1 question about validation every 2-3 months. We get questions about page load times (usually for the social modules, like you mention) multiple times every month. We have a philosophy of keeping settings to a minimum, and there's likely no way we'd add a "Enhanced Validation" setting at the expense of performance. Mainly, because the doctype change would cause so many issues that our support would be overwhelmed. Secondly though, because the Javascript you mention really isn't fixing the problem (as mentioned above), it's simply masking it. So, moving to that would simply slow the page down with no benefit. Even then, with those changes, you sound like you're choosing not to use them due to the performance problems.

Our minds can always be changed, but I'd really love to understand why validation is so important to you. I realize that it sounds good to validate, but we've never heard of a reason that you'd want to strive for 100%. Google has specifically said that validation errors will not affect your search engine rankings, and browsers can easily overcome almost all issues. That's not to say the HTML should be 'bad', it just doesn't need to be fully spec'd according to the doctype.

Hope that explains our position, but would love to discuss more if you have strong opinions on why validation is so important, when functionality is just fine without it.

Thanks,
Alex
The topic has been locked.