[
https://issues.apache.org/jira/browse/MYFACES-4736?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18047110#comment-18047110
]
Werner Punz edited comment on MYFACES-4736 at 12/22/25 8:42 PM:
----------------------------------------------------------------
ok this is pretty old code, I remember roughly that there were browser issues
back then when I implemented it, but by now it is definitely not needed
anymore, following code now should do the trick properly:
{color:#cf8e6d}private {color}{color:#56a8f5}_matchesSelector{color}(toMatch:
Element, selector: {color:#cf8e6d}string{color}): {color:#cf8e6d}boolean
{color}{
{color:#cf8e6d}if{color}(toMatch.{color:#56a8f5}matches{color}) {
{color:#cf8e6d}return {color}toMatch.{color:#56a8f5}matches{color}(selector);
}
{color:#cf8e6d}var {color}{color:#a9b7c6}foundElements {color}=
({color:#c77dba}document {color}||
{color:#a9b7c6}ownerDocument{color}).{color:#56a8f5}querySelectorAll{color}(selector);
{color:#cf8e6d}return
{color}{color:#56a8f5}Array{color}.{color:#c77dbb}prototype{color}.{color:#56a8f5}indexOf{color}.{color:#56a8f5}call{color}({color:#a9b7c6}foundElements{color},
toMatch) !== -{color:#2aacb8}1{color};
}
what the old code did was to use the vendor specific prefixes with query
selectorall prefix, to cover as many browsers as possible, but given that
{color:#56a8f5}matches is supported by all new browsers a simple querySelectAll
fallback probably suffices by now, no need to check for vendor specific methods
anymore!{color}
So we have slain two dragons with this, removal of vendor specific fallbacks,
removal of code stemming from an incompatible license!
I will roll a new version of the underlying library and then have the updated
code rolled into the new myfaces branches!
was (Author: werpu):
ok this is pretty old code, I remember roughly that there were browser issues
back then when I implemented it, but by now it is definitely not needed
anymore, following code now should do the trick properly:
{color:#cf8e6d}private {color}{color:#56a8f5}_matchesSelector{color}(toMatch:
Element, selector: {color:#cf8e6d}string{color}): {color:#cf8e6d}boolean
{color}{
{color:#cf8e6d}if{color}(toMatch.{color:#56a8f5}matches{color}) {
{color:#cf8e6d}return {color}toMatch.{color:#56a8f5}matches{color}(selector);
}
{color:#cf8e6d}var {color}{color:#a9b7c6}foundElements {color}=
({color:#c77dba}document {color}||
{color:#a9b7c6}ownerDocument{color}).{color:#56a8f5}querySelectorAll{color}(selector);
{color:#cf8e6d}return
{color}{color:#56a8f5}Array{color}.{color:#c77dbb}prototype{color}.{color:#56a8f5}indexOf{color}.{color:#56a8f5}call{color}({color:#a9b7c6}foundElements{color},
toMatch) !== -{color:#2aacb8}1{color};
}
what the old code did was to use the vendor specific prefixes with query
selectorall prefix, to cover as many browsers as possible, but given that
{color:#56a8f5}matches is supported by all new browsers a simple querySelectAll
fallback probably suffices by now, no need to check for vendor specific methods
anymore!{color}
So we have slain two dragons with this, removal of vendor specific fallbacks,
removal of code stemming from an incompatible license!
> Replace/remove javascript functions with share-alike license
> ------------------------------------------------------------
>
> Key: MYFACES-4736
> URL: https://issues.apache.org/jira/browse/MYFACES-4736
> Project: MyFaces Core
> Issue Type: Improvement
> Components: General
> Affects Versions: 4.1.2
> Reporter: Florian Schwarz
> Assignee: Werner Punz
> Priority: Major
>
> Some javascript function, e.g. _mozMatchesSelector in
> /META-INF/resources/jakarta.faces/faces-development.js, line 7152, contain a
> comment
> {code:java}
> // source: https:// developer.mozilla.org/en-US/docs/Web/API/Element/matches
> // code snippet license: https:// creativecommons.org/licenses/by-sa/2.5/
> {code}
> From my understanding, this by-sa (share-alike) means, that if one uses
> myfaces in its project, one has to use also the CC-BY-SA-2.5 license for his
> project ([https://creativecommons.org/licenses/by-sa/2.5/deed.en] ). So I
> wanted to ask if it would be possible to replace or remove those functions,
> allowing users of myfaces to use a different license.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)